From 9571bce2f886dcc846c8f11ab8e36e1559020162 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:01:43 +0000 Subject: [PATCH] Documentation for e278f5d74fe0ad4037f3e65272f5ab1c3026a7b2 --- annotated.html | 89 +-- annotated_dup.js | 1 + classes.html | 2 +- d0/dc1/dynamic__stack_8c__incl.map | 7 + d0/dc1/dynamic__stack_8c__incl.md5 | 1 + d0/dc1/dynamic__stack_8c__incl.svg | 82 ++ d4/d67/struct_d_array_stack.html | 140 ++++ d4/d67/struct_d_array_stack.js | 5 + d5/d24/dynamic__stack_8c.html | 699 ++++++++++++++++++ d5/d24/dynamic__stack_8c.js | 16 + ...540d7422773546a9b2f466bc49da068_cgraph.map | 4 + ...540d7422773546a9b2f466bc49da068_cgraph.md5 | 1 + ...540d7422773546a9b2f466bc49da068_cgraph.svg | 36 + ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 9 + ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 1 + ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 117 +++ ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 10 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 1 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 132 ++++ ...f3ec5aac14cef11d2666c0de4ba9b6e_cgraph.map | 5 + ...f3ec5aac14cef11d2666c0de4ba9b6e_cgraph.md5 | 1 + ...f3ec5aac14cef11d2666c0de4ba9b6e_cgraph.svg | 57 ++ dir_2176ba3565d8b1fe2a106d18679cc7bf.html | 3 + dir_2176ba3565d8b1fe2a106d18679cc7bf.js | 1 + files.html | 3 +- functions.html | 3 +- functions_vars.html | 3 +- globals_c.html | 1 + globals_d.html | 2 + globals_defs.html | 2 +- globals_func_c.html | 1 + globals_func_d.html | 1 + globals_func_i.html | 1 + globals_func_m.html | 2 +- globals_func_p.html | 5 +- globals_func_s.html | 3 + globals_func_t.html | 2 +- globals_i.html | 1 + globals_m.html | 4 +- globals_p.html | 5 +- globals_s.html | 3 + globals_t.html | 2 +- globals_type.html | 1 + navtreedata.js | 6 +- navtreeindex0.js | 60 +- navtreeindex1.js | 98 +-- navtreeindex2.js | 56 +- navtreeindex3.js | 74 +- navtreeindex4.js | 38 +- search/all_12.js | 95 +-- search/all_15.js | 85 ++- search/all_16.js | 6 +- search/all_3.js | 15 +- search/all_5.js | 19 +- search/all_6.js | 73 +- search/all_b.js | 13 +- search/all_f.js | 6 +- search/classes_4.js | 9 +- search/files_4.js | 3 +- search/functions_10.js | 67 +- search/functions_13.js | 35 +- search/functions_14.js | 2 +- search/functions_3.js | 9 +- search/functions_4.js | 3 +- search/functions_9.js | 13 +- search/functions_d.js | 2 +- search/typedefs_2.js | 3 +- search/variables_0.js | 5 +- search/variables_10.js | 2 +- 69 files changed, 1824 insertions(+), 438 deletions(-) create mode 100644 d0/dc1/dynamic__stack_8c__incl.map create mode 100644 d0/dc1/dynamic__stack_8c__incl.md5 create mode 100644 d0/dc1/dynamic__stack_8c__incl.svg create mode 100644 d4/d67/struct_d_array_stack.html create mode 100644 d4/d67/struct_d_array_stack.js create mode 100644 d5/d24/dynamic__stack_8c.html create mode 100644 d5/d24/dynamic__stack_8c.js create mode 100644 d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.map create mode 100644 d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.md5 create mode 100644 d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.svg create mode 100644 d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map create mode 100644 d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 create mode 100644 d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg create mode 100644 d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map create mode 100644 d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 create mode 100644 d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg create mode 100644 d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.map create mode 100644 d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.md5 create mode 100644 d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.svg diff --git a/annotated.html b/annotated.html index d4e19be0..2f829794 100644 --- a/annotated.html +++ b/annotated.html @@ -113,50 +113,51 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  CbufferStruct used to store character in certain times  CCArray  Ccluster - Cdata - CDict - Cdual_quat_Dual quaternion type - Cdynamic_array - CEdge - Celem - Ceuclidean_resultFor tests - Ceuler_3D Euler or Tait-Bryan angles (in radian) - Cgame_instanceFor main() - tolower() for main(), new_word(), new_guess(), won() - I/O operations for all functions - exit(), rand() and file functions for main() - for string operations strlen, strchr, strcpy for new_game() - used with srand() for declaring new game instance - CGraph - CGraphRep - Chash_set_t - Ckohonen_array_3dTo store info regarding 3D arrays - CL - ClistDoubly linked list struct - CListItemDefinition for a binary tree node - Cmat_3x3_A 3x3 Matrix type definition - Cmax_heapFor INT_MIN - CMEMORY_INFORMATIONFor the malloc, calloc and free functions - Cmin_heap - CNFADefinition for the NFA itself - CNFAStateDefinition for a NFA state - CNodeNode, the basic data structure of the tree - CnodeNode, the basic data structure in the tree - CNodeDistributeInfoDefinition for a binary tree node - Cobservation - CpidPID Controller - Cquaternion_Quaternion type represented using a scalar \(w\) or \(q_0\) and a 3D vector \(\left(q_1,q_2,q_3\right)\) - Cqueue - CQueueRep - Csegment_treeThis structures holds all the data that is required by a segment tree - Cstack - CStackFor printf() and scanf() - CStockSpanner - Csubset - CsudokuStructure to hold the matrix and dimensions - CT - CtermIdentifier for single-variable polynomial coefficients as a linked list - Ctnode - CtransRuleDefinition for a NFA state transition rule - Ctrie - Cvec_3d_3D vector type - CVectorFor IO operations - Cword_count_word + CDArrayStackTo verify assumptions made by the program and print a diagnostic message if this assumption is false + Cdata + CDict + Cdual_quat_Dual quaternion type + Cdynamic_array + CEdge + Celem + Ceuclidean_resultFor tests + Ceuler_3D Euler or Tait-Bryan angles (in radian) + Cgame_instanceFor main() - tolower() for main(), new_word(), new_guess(), won() - I/O operations for all functions - exit(), rand() and file functions for main() - for string operations strlen, strchr, strcpy for new_game() - used with srand() for declaring new game instance + CGraph + CGraphRep + Chash_set_t + Ckohonen_array_3dTo store info regarding 3D arrays + CL + ClistDoubly linked list struct + CListItemDefinition for a binary tree node + Cmat_3x3_A 3x3 Matrix type definition + Cmax_heapFor INT_MIN + CMEMORY_INFORMATIONFor the malloc, calloc and free functions + Cmin_heap + CNFADefinition for the NFA itself + CNFAStateDefinition for a NFA state + CNodeNode, the basic data structure of the tree + CnodeNode, the basic data structure in the tree + CNodeDistributeInfoDefinition for a binary tree node + Cobservation + CpidPID Controller + Cquaternion_Quaternion type represented using a scalar \(w\) or \(q_0\) and a 3D vector \(\left(q_1,q_2,q_3\right)\) + Cqueue + CQueueRep + Csegment_treeThis structures holds all the data that is required by a segment tree + Cstack + CStackFor printf() and scanf() + CStockSpanner + Csubset + CsudokuStructure to hold the matrix and dimensions + CT + CtermIdentifier for single-variable polynomial coefficients as a linked list + Ctnode + CtransRuleDefinition for a NFA state transition rule + Ctrie + Cvec_3d_3D vector type + CVectorFor IO operations + Cword_count_word diff --git a/annotated_dup.js b/annotated_dup.js index 11ea5666..c0ea69eb 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -11,6 +11,7 @@ var annotated_dup = [ "buffer", "dd/da2/structbuffer.html", null ], [ "CArray", "d4/d2d/struct_c_array.html", null ], [ "cluster", "d1/d99/structcluster.html", "d1/d99/structcluster" ], + [ "DArrayStack", "d4/d67/struct_d_array_stack.html", "d4/d67/struct_d_array_stack" ], [ "data", "df/dea/structdata.html", null ], [ "Dict", "d4/dfe/struct_dict.html", null ], [ "dual_quat_", "d7/dfd/structdual__quat__.html", "d7/dfd/structdual__quat__" ], diff --git a/classes.html b/classes.html index 8d226fd2..5e4cf3f4 100644 --- a/classes.html +++ b/classes.html @@ -113,7 +113,7 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
CArray
cluster
D
-
data
Dict
dual_quat_
dynamic_array
+
DArrayStack
data
Dict
dual_quat_
dynamic_array
E
Edge
elem
euclidean_result
euler_
diff --git a/d0/dc1/dynamic__stack_8c__incl.map b/d0/dc1/dynamic__stack_8c__incl.map new file mode 100644 index 00000000..f7444a7b --- /dev/null +++ b/d0/dc1/dynamic__stack_8c__incl.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/d0/dc1/dynamic__stack_8c__incl.md5 b/d0/dc1/dynamic__stack_8c__incl.md5 new file mode 100644 index 00000000..717c4378 --- /dev/null +++ b/d0/dc1/dynamic__stack_8c__incl.md5 @@ -0,0 +1 @@ +7e8f7d38846d03a03238ac88b941ff27 \ No newline at end of file diff --git a/d0/dc1/dynamic__stack_8c__incl.svg b/d0/dc1/dynamic__stack_8c__incl.svg new file mode 100644 index 00000000..b400f8dd --- /dev/null +++ b/d0/dc1/dynamic__stack_8c__incl.svg @@ -0,0 +1,82 @@ + + + + + + +data_structures/stack/dynamic_stack.c + + +Node1 + + +data_structures/stack +/dynamic_stack.c + + + + + +Node2 + + +assert.h + + + + + +Node1->Node2 + + + + + +Node3 + + +inttypes.h + + + + + +Node1->Node3 + + + + + +Node4 + + +stdio.h + + + + + +Node1->Node4 + + + + + +Node5 + + +stdlib.h + + + + + +Node1->Node5 + + + + + diff --git a/d4/d67/struct_d_array_stack.html b/d4/d67/struct_d_array_stack.html new file mode 100644 index 00000000..857a47d8 --- /dev/null +++ b/d4/d67/struct_d_array_stack.html @@ -0,0 +1,140 @@ + + + + + + + +Algorithms_in_C: DArrayStack Struct Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C 1.0.0 +
+
Set of algorithms implemented in C.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
DArrayStack Struct Reference
+
+
+ +

to verify assumptions made by the program and print a diagnostic message if this assumption is false. + More...

+ + + + + + + + + + +

+Data Fields

+int capacity
 
+int top
 to store capacity and top of the stack
 
+int * arrPtr
 array pointer
 
+

Detailed Description

+

to verify assumptions made by the program and print a diagnostic message if this assumption is false.

+

to provide a set of integer types with universally consistent definitions that are operating system-independent for IO operations for including functions involving memory allocation such as malloc

+

DArrayStack Structure of stack.

+

The documentation for this struct was generated from the following file: +
+
+ + + + diff --git a/d4/d67/struct_d_array_stack.js b/d4/d67/struct_d_array_stack.js new file mode 100644 index 00000000..8b5d3428 --- /dev/null +++ b/d4/d67/struct_d_array_stack.js @@ -0,0 +1,5 @@ +var struct_d_array_stack = +[ + [ "arrPtr", "d4/d67/struct_d_array_stack.html#aae446fbaecfeae53a970e7a63b74c126", null ], + [ "top", "d4/d67/struct_d_array_stack.html#a0207dbf74f0f8623933bec50c36b4c4f", null ] +]; \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c.html b/d5/d24/dynamic__stack_8c.html new file mode 100644 index 00000000..7db9486c --- /dev/null +++ b/d5/d24/dynamic__stack_8c.html @@ -0,0 +1,699 @@ + + + + + + + +Algorithms_in_C: data_structures/stack/dynamic_stack.c File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C 1.0.0 +
+
Set of algorithms implemented in C.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
dynamic_stack.c File Reference
+
+
+ +

Dynamic Stack, just like Dynamic Array, is a stack data structure whose the length or capacity (maximum number of elements that can be stored) increases or decreases in real time based on the operations (like insertion or deletion) performed on it. +More...

+
#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+Include dependency graph for dynamic_stack.c:
+
+
+
+
+
+ + + + +

+Data Structures

struct  DArrayStack
 to verify assumptions made by the program and print a diagnostic message if this assumption is false. More...
 
+ + + + +

+Typedefs

typedef struct DArrayStack DArrayStack
 to verify assumptions made by the program and print a diagnostic message if this assumption is false.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

DArrayStackcreate_stack (int cap)
 Create a Stack object.
 
DArrayStackdouble_array (DArrayStack *ptr, int cap)
 As this is stack implementation using dynamic array this function will expand the size of the stack by twice as soon as the stack is full.
 
DArrayStackshrink_array (DArrayStack *ptr, int cap)
 As this is stack implementation using dynamic array this function will shrink the size of stack by twice as soon as the stack's capacity and size has significant difference.
 
int push (DArrayStack *ptr, int data)
 The push function pushes the element onto the stack.
 
int pop (DArrayStack *ptr)
 The pop function to pop an element from the stack.
 
int peek (DArrayStack *ptr)
 To retrieve or fetch the first element of the Stack or the element present at the top of the Stack.
 
int show_capacity (DArrayStack *ptr)
 To display the current capacity of the stack.
 
int isempty (DArrayStack *ptr)
 The function is used to check whether the stack is empty or not and return true or false accordingly.
 
int stack_size (DArrayStack *ptr)
 Used to get the size of the Stack or the number of elements present in the Stack.
 
static void test ()
 Self-test implementations.
 
int main ()
 Main function.
 
+

Detailed Description

+

Dynamic Stack, just like Dynamic Array, is a stack data structure whose the length or capacity (maximum number of elements that can be stored) increases or decreases in real time based on the operations (like insertion or deletion) performed on it.

+

In this implementation, functions such as PUSH, POP, PEEK, show_capacity, isempty, and stack_size are coded to implement dynamic stack.

+
Author
SahilK-027
+

Typedef Documentation

+ +

◆ DArrayStack

+ +
+
+ + + + +
typedef struct DArrayStack DArrayStack
+
+ +

to verify assumptions made by the program and print a diagnostic message if this assumption is false.

+

to provide a set of integer types with universally consistent definitions that are operating system-independent for IO operations for including functions involving memory allocation such as malloc

+

DArrayStack Structure of stack.

+ +
+
+

Function Documentation

+ +

◆ create_stack()

+ +
+
+ + + + + + + + +
DArrayStack * create_stack (int cap)
+
+ +

Create a Stack object.

+
Parameters
+ + +
capCapacity of stack
+
+
+
Returns
DArrayStack* Newly created stack object pointer
+
37{
+
38 DArrayStack *ptr;
+
39 ptr = (DArrayStack *)malloc(sizeof(DArrayStack));
+
40 ptr->capacity = cap;
+
41 ptr->top = -1;
+
42 ptr->arrPtr = (int *)malloc(sizeof(int) * cap);
+
43 printf("\nStack of capacity %d is successfully created.\n", ptr->capacity);
+
44 return (ptr);
+
45}
+
#define malloc(bytes)
This macro replace the standard malloc function with malloc_dbg.
Definition: malloc_dbg.h:18
+
to verify assumptions made by the program and print a diagnostic message if this assumption is false.
Definition: dynamic_stack.c:25
+
int top
to store capacity and top of the stack
Definition: dynamic_stack.c:26
+
int * arrPtr
array pointer
Definition: dynamic_stack.c:27
+
+
+
+ +

◆ double_array()

+ +
+
+ + + + + + + + + + + + + + + + + + +
DArrayStack * double_array (DArrayStackptr,
int cap 
)
+
+ +

As this is stack implementation using dynamic array this function will expand the size of the stack by twice as soon as the stack is full.

+
Parameters
+ + + +
ptrStack pointer
capCapacity of stack
+
+
+
Returns
DArrayStack*: Modified stack
+
56{
+
57 int newCap = 2 * cap;
+
58 int *temp;
+
59 temp = (int *)malloc(sizeof(int) * newCap);
+
60 for (int i = 0; i < (ptr->top) + 1; i++)
+
61 {
+
62 temp[i] = ptr->arrPtr[i];
+
63 }
+
64 free(ptr->arrPtr);
+
65 ptr->arrPtr = temp;
+
66 ptr->capacity = newCap;
+
67 return ptr;
+
68}
+
#define free(ptr)
This macro replace the standard free function with free_dbg.
Definition: malloc_dbg.h:26
+
+
+
+ +

◆ isempty()

+ +
+
+ + + + + + + + +
int isempty (DArrayStackptr)
+
+ +

The function is used to check whether the stack is empty or not and return true or false accordingly.

+
Parameters
+ + +
ptrStack pointer
+
+
+
Returns
int returns 1 -> true OR returns 0 -> false
+
178{
+
179 if (ptr->top == -1)
+
180 {
+
181 return 1;
+
182 }
+
183 return 0;
+
184}
+
+
+
+ +

◆ main()

+ +
+
+ + + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+
247{
+
248 test(); // run self-test implementations
+
249 return 0;
+
250}
+
static void test()
Self-test implementations.
Definition: dynamic_stack.c:199
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ peek()

+ +
+
+ + + + + + + + +
int peek (DArrayStackptr)
+
+ +

To retrieve or fetch the first element of the Stack or the element present at the top of the Stack.

+
Parameters
+ + +
ptrStack pointer
+
+
+
Returns
int Top of the stack
+
153{
+
154 if (ptr->top == -1)
+
155 {
+
156 printf("Stack is empty UNDERFLOW \n");
+
157 return -1;
+
158 }
+
159 return ptr->arrPtr[ptr->top];
+
160}
+
+
+
+ +

◆ pop()

+ +
+
+ + + + + + + + +
int pop (DArrayStackptr)
+
+ +

The pop function to pop an element from the stack.

+
Parameters
+ + +
ptrStack pointer
+
+
+
Returns
int Popped value
+
125{
+
126 if (ptr->top == -1)
+
127 {
+
128 printf("Stack is empty UNDERFLOW \n");
+
129 return -1;
+
130 }
+
131 int ele = ptr->arrPtr[ptr->top];
+
132 ptr->arrPtr[ptr->top] = 0;
+
133 ptr->top = (ptr->top - 1);
+
134 if ((ptr->capacity) % 2 == 0)
+
135 {
+
136 if (ptr->top <= (ptr->capacity / 2) - 1)
+
137 {
+
138 ptr = shrink_array(ptr, ptr->capacity);
+
139 }
+
140 }
+
141 printf("Successfully popped: %d\n", ele);
+
142 return ele;
+
143}
+
DArrayStack * shrink_array(DArrayStack *ptr, int cap)
As this is stack implementation using dynamic array this function will shrink the size of stack by tw...
Definition: dynamic_stack.c:79
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ push()

+ +
+
+ + + + + + + + + + + + + + + + + + +
int push (DArrayStackptr,
int data 
)
+
+ +

The push function pushes the element onto the stack.

+
Parameters
+ + + +
ptrStack pointer
dataValue to be pushed onto stack
+
+
+
Returns
int Position of top pointer
+
102{
+
103 if (ptr->top == (ptr->capacity) - 1)
+
104 {
+
105 ptr = double_array(ptr, ptr->capacity);
+
106 ptr->top++;
+
107 ptr->arrPtr[ptr->top] = data;
+
108 }
+
109 else
+
110 {
+
111 ptr->top++;
+
112 ptr->arrPtr[ptr->top] = data;
+
113 }
+
114 printf("Successfully pushed : %d\n", data);
+
115 return ptr->top;
+
116}
+
DArrayStack * double_array(DArrayStack *ptr, int cap)
As this is stack implementation using dynamic array this function will expand the size of the stack b...
Definition: dynamic_stack.c:55
+
Definition: prime_factoriziation.c:25
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ show_capacity()

+ +
+
+ + + + + + + + +
int show_capacity (DArrayStackptr)
+
+ +

To display the current capacity of the stack.

+
Parameters
+ + +
ptrStack pointer
+
+
+
Returns
int Current capacity of the stack
+
168{ return ptr->capacity; }
+
+
+
+ +

◆ shrink_array()

+ +
+
+ + + + + + + + + + + + + + + + + + +
DArrayStack * shrink_array (DArrayStackptr,
int cap 
)
+
+ +

As this is stack implementation using dynamic array this function will shrink the size of stack by twice as soon as the stack's capacity and size has significant difference.

+
Parameters
+ + + +
ptrStack pointer
capCapacity of stack
+
+
+
Returns
DArrayStack*: Modified stack
+
80{
+
81 int newCap = cap / 2;
+
82 int *temp;
+
83 temp = (int *)malloc(sizeof(int) * newCap);
+
84 for (int i = 0; i < (ptr->top) + 1; i++)
+
85 {
+
86 temp[i] = ptr->arrPtr[i];
+
87 }
+
88 free(ptr->arrPtr);
+
89 ptr->arrPtr = temp;
+
90 ptr->capacity = newCap;
+
91 return ptr;
+
92}
+
+
+
+ +

◆ stack_size()

+ +
+
+ + + + + + + + +
int stack_size (DArrayStackptr)
+
+ +

Used to get the size of the Stack or the number of elements present in the Stack.

+
Parameters
+ + +
ptrStack pointer
+
+
+
Returns
int size of stack
+
193{ return ptr->top + 1; }
+
+
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + + +
static void test (void )
+
+static
+
+ +

Self-test implementations.

+
Returns
void
+
200{
+
201 DArrayStack *NewStack;
+
202 int capacity = 1;
+
203 NewStack = create_stack(capacity);
+
204 uint64_t arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+
205
+
206 printf("\nTesting Empty stack: ");
+
207 assert(stack_size(NewStack) == 0);
+
208 assert(isempty(NewStack) == 1);
+
209 printf("Size of an empty stack is %d\n", stack_size(NewStack));
+
210
+
211 printf("\nTesting PUSH operation:\n");
+
212 for (int i = 0; i < 12; ++i)
+
213 {
+
214 int topVal = push(NewStack, arr[i]);
+
215 printf("Size: %d, Capacity: %d\n\n", stack_size(NewStack),
+
216 show_capacity(NewStack));
+
217 assert(topVal == i);
+
218 assert(peek(NewStack) == arr[i]);
+
219 assert(stack_size(NewStack) == i + 1);
+
220 assert(isempty(NewStack) == 0);
+
221 }
+
222
+
223 printf("\nTesting POP operation:\n");
+
224 for (int i = 11; i > -1; --i)
+
225 {
+
226 peek(NewStack);
+
227 assert(peek(NewStack) == arr[i]);
+
228 int ele = pop(NewStack);
+
229 assert(ele == arr[i]);
+
230 assert(stack_size(NewStack) == i);
+
231 }
+
232
+
233 printf("\nTesting Empty stack size: ");
+
234 assert(stack_size(NewStack) == 0);
+
235 assert(isempty(NewStack) == 1);
+
236 printf("Size of an empty stack is %d\n", stack_size(NewStack));
+
237
+
238 printf("\nTesting POP operation on empty stack: ");
+
239 assert(pop(NewStack) == -1);
+
240}
+
int isempty(DArrayStack *ptr)
The function is used to check whether the stack is empty or not and return true or false accordingly.
Definition: dynamic_stack.c:177
+
int show_capacity(DArrayStack *ptr)
To display the current capacity of the stack.
Definition: dynamic_stack.c:168
+
DArrayStack * create_stack(int cap)
Create a Stack object.
Definition: dynamic_stack.c:36
+
int stack_size(DArrayStack *ptr)
Used to get the size of the Stack or the number of elements present in the Stack.
Definition: dynamic_stack.c:193
+
char pop()
Function to pop from the stack.
Definition: infix_to_postfix2.c:45
+
void push(struct Stack *p, char ch)
push function
Definition: infix_to_postfix.c:55
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+
+
+ + + + diff --git a/d5/d24/dynamic__stack_8c.js b/d5/d24/dynamic__stack_8c.js new file mode 100644 index 00000000..e1b6f0ea --- /dev/null +++ b/d5/d24/dynamic__stack_8c.js @@ -0,0 +1,16 @@ +var dynamic__stack_8c = +[ + [ "DArrayStack", "d4/d67/struct_d_array_stack.html", "d4/d67/struct_d_array_stack" ], + [ "DArrayStack", "d5/d24/dynamic__stack_8c.html#aae116f0ceb8ee66fc9255762ccd7bfd6", null ], + [ "create_stack", "d5/d24/dynamic__stack_8c.html#ab628a00140af56945b3f514cef0b3da0", null ], + [ "double_array", "d5/d24/dynamic__stack_8c.html#ac01c5d1d1000ed68b5ff093c5ff36854", null ], + [ "isempty", "d5/d24/dynamic__stack_8c.html#a0eebbddad64a35d337093293466e26a1", null ], + [ "main", "d5/d24/dynamic__stack_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "peek", "d5/d24/dynamic__stack_8c.html#a68471e91db2e62acd584744c24a09a4f", null ], + [ "pop", "d5/d24/dynamic__stack_8c.html#a4540d7422773546a9b2f466bc49da068", null ], + [ "push", "d5/d24/dynamic__stack_8c.html#aff3ec5aac14cef11d2666c0de4ba9b6e", null ], + [ "show_capacity", "d5/d24/dynamic__stack_8c.html#a9fe3f4e1147dd49a0ad4ca8f0228827d", null ], + [ "shrink_array", "d5/d24/dynamic__stack_8c.html#a072451a98105e776e63cb5dd792d562f", null ], + [ "stack_size", "d5/d24/dynamic__stack_8c.html#ad46c93f9aac8431f73dc5e3a4413097e", null ], + [ "test", "d5/d24/dynamic__stack_8c.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.map b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.map new file mode 100644 index 00000000..97616c78 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.md5 b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.md5 new file mode 100644 index 00000000..1d9e0ea5 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.md5 @@ -0,0 +1 @@ +604142d5243a715751b1e1a1ec205739 \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.svg b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.svg new file mode 100644 index 00000000..cfa2cd70 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_a4540d7422773546a9b2f466bc49da068_cgraph.svg @@ -0,0 +1,36 @@ + + + + + + +pop + + +Node1 + + +pop + + + + + +Node2 + + +shrink_array + + + + + +Node1->Node2 + + + + + diff --git a/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map new file mode 100644 index 00000000..ece1d953 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 new file mode 100644 index 00000000..4bcc818f --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -0,0 +1 @@ +0a93451a264ce6e39f08fcdeb24b7fc0 \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg new file mode 100644 index 00000000..597dc415 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -0,0 +1,117 @@ + + + + + + +test + + +Node1 + + +test + + + + + +Node2 + + +create_stack + + + + + +Node1->Node2 + + + + + +Node3 + + +isempty + + + + + +Node1->Node3 + + + + + +Node4 + + +pop + + + + + +Node1->Node4 + + + + + +Node5 + + +push + + + + + +Node1->Node5 + + + + + +Node6 + + +show_capacity + + + + + +Node1->Node6 + + + + + +Node7 + + +stack_size + + + + + +Node1->Node7 + + + + + +Node5->Node5 + + + + + diff --git a/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 00000000..ee7cecb7 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 00000000..9bf69b1f --- /dev/null +++ b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +61da4caad125ec4690e71fcf7d304cad \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 00000000..55253480 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,132 @@ + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + +Node3 + + +create_stack + + + + + +Node2->Node3 + + + + + +Node4 + + +isempty + + + + + +Node2->Node4 + + + + + +Node5 + + +pop + + + + + +Node2->Node5 + + + + + +Node6 + + +push + + + + + +Node2->Node6 + + + + + +Node7 + + +show_capacity + + + + + +Node2->Node7 + + + + + +Node8 + + +stack_size + + + + + +Node2->Node8 + + + + + +Node6->Node6 + + + + + diff --git a/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.map b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.map new file mode 100644 index 00000000..f99eb148 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.md5 b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.md5 new file mode 100644 index 00000000..116f32d3 --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.md5 @@ -0,0 +1 @@ +f4d13b8689dc3d343904e88398af5c74 \ No newline at end of file diff --git a/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.svg b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.svg new file mode 100644 index 00000000..b07eb74c --- /dev/null +++ b/d5/d24/dynamic__stack_8c_aff3ec5aac14cef11d2666c0de4ba9b6e_cgraph.svg @@ -0,0 +1,57 @@ + + + + + + +push + + +Node1 + + +push + + + + + +Node2 + + +double_array + + + + + +Node1->Node2 + + + + + +Node3 + + +push + + + + + +Node1->Node3 + + + + + +Node3->Node3 + + + + + diff --git a/dir_2176ba3565d8b1fe2a106d18679cc7bf.html b/dir_2176ba3565d8b1fe2a106d18679cc7bf.html index e6d2e141..2762e907 100644 --- a/dir_2176ba3565d8b1fe2a106d18679cc7bf.html +++ b/dir_2176ba3565d8b1fe2a106d18679cc7bf.html @@ -114,6 +114,9 @@ Directories + + +

Files

file  dynamic_stack.c
 Dynamic Stack, just like Dynamic Array, is a stack data structure whose the length or capacity (maximum number of elements that can be stored) increases or decreases in real time based on the operations (like insertion or deletion) performed on it.
 
file  stack.h [code]
 
diff --git a/dir_2176ba3565d8b1fe2a106d18679cc7bf.js b/dir_2176ba3565d8b1fe2a106d18679cc7bf.js index 389b1a3f..3f7f151a 100644 --- a/dir_2176ba3565d8b1fe2a106d18679cc7bf.js +++ b/dir_2176ba3565d8b1fe2a106d18679cc7bf.js @@ -1,5 +1,6 @@ var dir_2176ba3565d8b1fe2a106d18679cc7bf = [ [ "stack_linked_list", "dir_0472225043064b54f3dfff9011a9fae0.html", "dir_0472225043064b54f3dfff9011a9fae0" ], + [ "dynamic_stack.c", "d5/d24/dynamic__stack_8c.html", "d5/d24/dynamic__stack_8c" ], [ "stack.h", "d7/de0/stack_8h_source.html", null ] ]; \ No newline at end of file diff --git a/files.html b/files.html index 375a4d9d..6c6ffc98 100644 --- a/files.html +++ b/files.html @@ -156,7 +156,8 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });   stack   stack_linked_list  stack.h - stack.h + dynamic_stack.cDynamic Stack, just like Dynamic Array, is a stack data structure whose the length or capacity (maximum number of elements that can be stored) increases or decreases in real time based on the operations (like insertion or deletion) performed on it + stack.h  vector.cThis is a vector implemenation in C   developer_tools  malloc_dbg.cThis file contains malloc_dbg, calloc_dbg, free_dbg and printLeaks implementations diff --git a/functions.html b/functions.html index f717bda8..c6bca3e2 100644 --- a/functions.html +++ b/functions.html @@ -101,6 +101,7 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();

- a -

@@ -238,7 +239,7 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();

- t -

diff --git a/functions_vars.html b/functions_vars.html index 95036fb4..daeaa542 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -101,6 +101,7 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl

- a -

@@ -238,7 +239,7 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl

- t -

diff --git a/globals_c.html b/globals_c.html index df6fd890..bed58467 100644 --- a/globals_c.html +++ b/globals_c.html @@ -133,6 +133,7 @@ $(document).ready(function(){initNavTree('globals_c.html',''); initResizable();
  • create_matrix() : qr_eigen_values.c
  • create_node() : threaded_binary_trees.c, circular_doubly_linked_list.c
  • create_polynomial() : poly_add.c
  • +
  • create_stack() : dynamic_stack.c
  • createNFA() : mcnaughton_yamada_thompson.c
  • createNode() : mcnaughton_yamada_thompson.c
  • createRule() : mcnaughton_yamada_thompson.c
  • diff --git a/globals_d.html b/globals_d.html index f0235099..94283e4c 100644 --- a/globals_d.html +++ b/globals_d.html @@ -101,6 +101,7 @@ $(document).ready(function(){initNavTree('globals_d.html',''); initResizable();

    - d -

    diff --git a/globals_defs.html b/globals_defs.html index c9ca4840..c5858a52 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -152,8 +152,8 @@ $(document).ready(function(){initNavTree('globals_defs.html',''); initResizable(

    - m -

    diff --git a/globals_func_i.html b/globals_func_i.html index 05a558f8..cc86d77d 100644 --- a/globals_func_i.html +++ b/globals_func_i.html @@ -123,6 +123,7 @@ $(document).ready(function(){initNavTree('globals_func_i.html',''); initResizabl
  • isAccepting() : mcnaughton_yamada_thompson.c
  • isbad_alphabet() : decimal_to_any_base.c
  • isEmpty() : infix_to_postfix.c, infix_to_postfix2.c
  • +
  • isempty() : dynamic_stack.c
  • isLiteral() : mcnaughton_yamada_thompson.c
  • isOprnd() : infix_to_postfix.c
  • isPalindrome() : palindrome.c
  • diff --git a/globals_func_m.html b/globals_func_m.html index c16d3cd4..44276719 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -100,7 +100,7 @@ $(document).ready(function(){initNavTree('globals_func_m.html',''); initResizabl  

    - m -