Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Assignment – I

Data Structure (CS 21001)

Unit – 1 (Introduction)

1. Design an algorithm whose worst case time complexity is O(m + n log n)


2. Design an algorithm whose worst case time complexity is O(m + n2 log m)
3. Design an algorithm whose worst case time complexity is O(m2+ n (log m)2)
4. Write down the algorithm that input 2 binary strings and print their binary sum.
5. Write down the algorithm to find highest frequency character in a string.
6. Write down the algorithm to count repeated words from a string.
7. A program P reads in 500 random integers in the range [0..100] presenting the scores of 500
students. It then prints the frequency of each score above 50. What would be the best way for
P to store the frequencies?
8. Write down the algorithm to delete all the vowels in a character array.
9. Write down the algorithm to print all the elements below the minor diagonal in a 2-D array.
10. Write an algorithm to find a triplet that sum to a given value
11. Given an array arr, write an algorithm to find the maximum j – i such that arr[j] > arr[i]
12. Write an algorithm to replace every element in the array with the next greatest element
present in the same array.
13. Write down the algorithm to sort elements by their frequency.
14. Write down the algorithm to add two polynomials of single variable.
15. Discuss the significance and limitations of the Big O notation.

Unit – 2 (LinkedList, Stack & Queues)

1. Design algorithm/develop pseudocode/write C code to delete n nodes after m nodes of a


linked list
2. Design algorithm/develop pseudocode/write C code to check if a singly linked list is
palindrome
3. Design algorithm/develop pseudocode/write C code to search an element in a linked list, if
found delete that node and insert that node at beginning. Otherwise display an appropriate
message.
4. Design algorithm/develop pseudocode/write C code to add, subtract and multiply 2
polynomials.
5. Design algorithm/develop pseudocode/write C code to delete last occurrence of an item from
linked list
6. Given a singly linked list with nodes L0 -> L1 -> … -> Ln-1 -> Ln. Design the
algorithm/develop pseudocode/write C code to rearrange the nodes in the list so that the new
formed list is : L0 -> Ln -> L1 -> Ln-1 -> L2 -> Ln-2 …
7. Design algorithm/develop pseudocode/write C code to create a linked list from a given linked
list. The new linked list must contain every alternate element of the existing linked list.
8. Design algorithm/develop pseudocode/write C code to count the number of times a given key
occurs in a linked list.
9. Design algorithm/develop pseudocode/write C code to delete all duplicate nodes from a
doubly circular linked list.
10. Design algorithm/develop pseudocode/write C code to delete consecutive two nodes from a
doubly linked list based on the given position
11. Write an algorithm to convert an infix expression into it equivalent postfix expression.
Explain the execution of algorithm using the expression (A+B)*C–(D*E)î(F+G+(H*M))
12. Write C functions for insertion, deletion, traversal operation for circular queues
13. Write C functions for insertion, deletion, traversal operation for input restricted deques
14. Write C functions for insertion, deletion, traversal operation for output restricted deques
15. Write an algorithm to copy the data elements of one stack to other without changing the order
and without using any other data structure
16. Write C functions for insertion, deletion, traversal operation for priority queues
17. Write an algorithm to check for balanced parentheses (, ), {, }, [ and ] in an expression
18. Write recursive pseudo code or recursive function to display the string in reverse order.
19. Write an algorithm to convert postfix expression to infix expression.
20. Write an algorithm to convert prefix expression to infix expression.
21. Given stack data structure, implement queue using only given stack data structure.
22. Given queue data structure, implement stack using only given queue data structure.
23. Write an algorithm or c code segment for insertion, deletion, peek and traversal of priority
queue using dynamic arrays.
24. Write an algorithm or c code segment for insertion, deletion, peek and traversal of priority
queue using linked list.
25. Write an algorithm or c code segment to reverse the queue.

*** All the best ***

You might also like