




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
C programming and its data structures and algorithms notes in detail
Typology: Lecture notes
1 / 36
This page cannot be seen from the preview
Don't miss anything!





























Department of Computer Science, Virtual University of Pakistan
Week No. Lab Topic Page No. 1 Lab 1: Learn to implement linked list data structure 2 2 Lab 2: Learn to implement stack data structure using array 3 3 Lab 3: Learn to implement queue data structure using link list 4 4 Lab 4: Learn to draw binary search tree and implement in-order traversal 5 5 Lab 5: Learn to implement binary search tree for string type data (^7) 6 Lab 6: Learn to understand and implement function call by value, reference and pointer
7 Lab 7: Learn to understand and implement function call by value, reference and pointer
8 Lab 8: Learn to delete nodes from BST 19 Midterm Exams 9 Learn to delete nodes from AVL tree 20 10 Learn to build frequency table and Huffman encoding tree 22 11 Lab 11: Learn to implement min heap using insert( ) method 24 12 Lab 12: Learn to implement min heap using buildHeap( ) method 29 13 Lab 13: Learn to build union tree 30 14 Lab 14: Learn to implement binary search algorithm 31 15 Lab 15: Build Hash table using linear probing collision resolution technique
16 Lab 16: Learn to sort array using bubble sort algorithm 34
programming language
Write a C++ program to implement data structure Stack. You have to write all the stack functions and using those functions insert the numbers 1 to 10 into the stack. The stack should be able to show the error messages if the push( ) operation is initiated but the stack is full or the pop( ) operation is initiated but the stack is empty.
programming language.
Write the C++ Code for the enqueue( ), dequeue( ), front( ) and the rear( ) functions of the class queue.
int main() { int Array[]={14, 15, 4, 9, 7, 18, 3, 5, 16, 4, 20, 17, 9, 14, 5,-1}; TreeNode
C++ programming language.
Write C++ code that will draw BST using string type of data: "babble", "fable", "jacket","backup", "eagle","daily","gain","bandit","abandon", "abash","accuse","economy","adhere","advise","cease","debunk","feeder","genius","fetch","chai n", NULL Note: Template_BSTNode.cpp Template_Node_SLL.cpp and Template_Queue_LinkedList.cpp files will students search from CS301 handouts or may be provided by the tutor/Instructor. #include
void insert(BSTNode
template
template
myQueue.push(node->getRight()); } system("pause"); }
myInt = 31 ; retVal = intMinus2( &myInt ); //call by passing a pointer cout << “After returning from the called function intMinus2” << endl; cout << ”The value returned by the called function (retVal) is : ” << retVal ; cout << endl; cout << ”The value of the calling function’s variable (myInt) is : ” << myInt ; cout << endl << endl; // now pass the argument by as reference, also initialize the value of myInt myInt = 31 ; retVal = intMinus3( myInt ); //call by passing a reference cout << “After returning from the called function intMinus3” << endl; cout << ”The value returned by the called function (retVal) is : ” << retVal ; cout << endl; cout << ”The value of the calling function’s variable (myInt) is : ” << myInt ; }
Draw Binary Search Tree from the given data. Also draw Binary Search Tree after removal of value ‘9’. 9 4 6 17 2 8 4 15 41 47 29
Build AVL tree from the given Data: 3 5 6 7 9 10 11 21 20 18 19 Note : You have to show only final AVL tree after insertion of each node value.