Basic CS-Data Structures [3i Infotech Placement]: Sample Questions 9 - 10 of 52

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 9

Data Structures
Edit

Describe in Detail

Essay▾

Sort the given values using Quick sort?

65 70 75 80 85 60 55 50 45

Explanation

  • Sorting take place from the pivot value, which is the first value of the given elements.
  • The values at the left pointer and right pointer are indicated using L and R respectively.

    65 70L 75 80 85 60 55 50 45R

  • Pivot is not changed the same process is continued after interchange the values at L and R positions.

    65 45 75L 80 85 60 55 50R 70

    65 45 50 80L 85 60 55R 75 70

    65 45 50 55 85L 60R 80 75 70

    65 45 50 55 60R 85L 80 75 70

  • When the L and R pointers cross each other the pivot value is interchange with the value at right pointer.
  • The pivot element is changing that means the pivot element occupy original position in the sorted order.
  • So, two different arrays are formed, one from start of the original array to the pivot position -1 and the second from position + 1 to end.

    60L 45 50 55R 65 85L 80 75 70R

    55L 45 50R 60 65 70R 80L 75 85

    50L 45R 55 60 65 70 80L 76R 85

  • The next pass we get the sorted from of the array.

45 50 55 60 65 70 75 80 85

Question 10

Data Structures
Edit

Describe in Detail

Essay▾

List areas where data structures are applied extensively?

Explanation

  • Compiler Design
  • Operating System
  • Database Management System
  • Statistical analysis package
  • Numerical Analysis
  • Graphics
  • Artificial Intelligence
  • Simulation

Developed by: