0% found this document useful (0 votes)
34 views1 page

Hndit 1

Uploaded by

www.infas7771
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Hndit 1

Uploaded by

www.infas7771
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

‭HNDIT3032 -‬‭D‬‭ata Structure and Algorithm‬

‭Post Midterm Examination 23.‬‭1‬‭1.2024‬


‭Duration:‬‭90‬‭Minutes‬ ‭Index No:_________________‬

‭Answer‬‭all‬‭questions and‬‭number‬‭them correctly. Please‬‭return‬‭this paper upon completion.‬

‭1.‬
‭a.‬ W ‭ hat is an‬‭Abstract Data Type (ADT)‬‭? How does it differ‬‭from a data‬
‭structure?‬
‭b.‬ ‭Write a Java method or pseudocode to determine whether a given integer‬
‭is a prime number.. (Hint: A prime number is greater than 1 and divisible‬
‭only by 1 and itself.)‬
‭c.‬ ‭What is‬‭Big O Notation‬‭, and why is it important in‬‭analysis of algorithm?‬
‭d.‬ ‭Define an array data structure and explain the Big O time complexities for‬
‭search, insert, add, and delete operations.‬

‭2.‬
‭a.‬ C ‭ ompare‬‭ArrayList‬‭and‬‭LinkedList‬‭in terms of their‬‭structure,‬
‭performance,e.‬
‭b.‬ ‭Explain the‬‭Push‬‭,‬‭Pop‬‭, and‬‭Peek‬‭operations in a‬‭Stack‬
‭c.‬ ‭Explain the‬‭Front‬‭and‬‭Rear‬‭pointers in a‬‭Queue‬‭, and‬‭illustrate the add‬
‭and remove‬
‭d.‬ ‭Diagramatically Show the insertion of following dataset in binary search‬
‭tree‬
‭50, 30, 70, 20, 40, 60, 80, 10, 25, 65‬‭.‬
‭3.‬
‭a.‬ W ‭ hat is search algorithm? Briefly explain two types of searching‬
‭algorithm?‬
‭b.‬ ‭Write a java code for linear search?‬
‭c.‬ ‭Selection sort is better than bubble sort, do you agree? Justify your‬
‭answer‬
‭d.‬ ‭List down the time complexity for considering the worst case scenario‬
‭Operation‬ ‭Array‬ ‭Arraylist‬ ‭Linkedlist‬ ‭Stack‬ ‭Queue‬ ‭ inary‬
B ‭ inear‬
L ‭ inary‬
B I‭nsertio‬ ‭ election‬
S ‭ ubble‬
B
‭Search‬ ‭Search‬ ‭Search‬ ‭n Sort‬ ‭Sort‬ ‭Sort‬
‭Tree‬

‭ earch/S‬
S
‭ort‬

‭Insert‬

‭Delete‬

You might also like