



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
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An online study material for the 3rd semester of B.Sc Computer Science & BCA at Majlis Arts and Science College, Puramannur. It covers topics such as postfix notation, sparse matrix, recursion, linked lists, linear arrays, and insertion and deletion operations. The document also includes algorithms for insertion in a singly linked list, infix to postfix conversion, and inserting an element in a linear linked list.
Typology: Exercises
1 / 7
This page cannot be seen from the preview
Don't miss anything!
DATA STRUCTURES USING C (3rd^ Semester Online Study Material) B.Sc Computer Science & BCA (Questions and answers based on second Module)
pointer and data which are there in singly linked list.
Traversal Insertion Deletion Traversal It prints all the array elements one after another. Algorithm LA is a linear array with lower bound LB and upper bound UB. step 1: set k=LB step 2: Repeat steps 3 and 4 while k<=UB
step 3: Apply visit to LA[k] step 4: set k=k+ step 5: exit Insertion It adds an element at given index. Algorithm INSERT(LA,N,K,ITEM) LA is a linear array with N elements and K is a positive integer K<=N. This algorithm inserts an element ITEM into the Kth position in LA. Step 1: set J=N step 2: Repeat steps 3 and 4 while J>=K step 3: set LA[J+1]=LA[J] step 4: set J=J- step 5: set LA[K]=ITEM step 6: set N=N+ step 7: exit Deletion Operation of removing one of the elements from LA. Algorithm DELETE(LA,N,K,ITEM) LA is a linear array with N elements and K is a positive integer ,K<=N. This algorithm deletes the Kth element from LA. step 1: set ITEM=LA[K] step 2: Repeat for J=K to N- step 3: set LA[J]=LA[J+1] step 4: set N=N- step 5: exit
B : Base address of the array w : Size of each element of the array L1 : lower bound of row L2 : lower bound of column
Find memory location in row major order
Eg: find location of A[4]=A[1][0] Row major address = B + w * (N * (i-L1) + j-L2) here, B= w = L1=L2=0 N= A[1 ][0] location=200+2[3*(1-0)+(0-0)] =200+ 6=
Find memory location in column major order
Eg: find location of A[4]=A[1][0] Column major address = B + w * (M * (j-L2) + (i-L1)) here, B= w = L1=L2=0 M= A[1 ][0] location=200+2[2(0-0)+(1-0)] =200+ 2=
Example : A+B (A+B) * (C-D) Prefix : An expression is called the prefix expression if the operator appears in the expression before the operands. Prefix notation is also known as Polish Notation.
Example : infix prefix A+B +AB (A+B) * (C-D) *+AB-CD Postfix : An expression is called the postfix expression if the operator appears in the expression after the operands. Postfix notation is also known as Reverse Polish Notation or Suffix.
Example : infix postfix A+B AB+
Insert first