Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review & Lab assignments

Similar presentations


Presentation on theme: "Review & Lab assignments"— Presentation transcript:

1 Review & Lab assignments
Lab guide #11 C Data Structures Review & Lab assignments

2 Key points Self-Referential Structure Dynamic Memory Allocation
Dynamic data structures Linked lists Stacks Queues Trees

3 Self-Referential Structures
Structure contains a pointer to a structure of the same type struct node { int data; struct node *nextPtr; } nextPtr Points to an object of type node Referred to as a link

4 Dynamic Memory Allocation
malloc (): Obtain memory for a new structure Takes number of bytes to allocate Return a void * pointer or Null Example: newPtr = malloc( sizeof( struct node ) ); free (): Release memory Deallocates memory allocated by malloc Takes a pointer as an argument free ( newPtr );

5 Dynamic data structures
Data structures that grow and shrink during execution Linked lists Allow insertions and removals anywhere Can be used when the number of data element is unpredictable Stacks Allow insertions and removals only at top of stack Rule: Last in first out Queues Allow insertions at the back and removals from the front Rule: First in, first out Binary trees High-speed searching and sorting of data and efficient elimination of duplicate data items

6 Lab assignments Fig 12.3 Fig 12.8 Fig 12.13 Fig 12.19


Download ppt "Review & Lab assignments"

Similar presentations


Ads by Google