virtual-labs-archive / data-structures-iiith

This repository contains sources to Data Structures Lab IIITH.
https://cse01-iiith.vlabs.ac.in/
Other
1 stars 73 forks source link

Sorting-Algorithm_Quick-Sort_Quizzes #243

Open adityaddy opened 5 years ago

adityaddy commented 5 years ago

Description - Wrong Text Formatting.

Steps to reproduce the issue - Link

Expected Result - Formatted & Readable Text, Spelling of sequences

Actual Result - Not Readable text. (The way we have described merge sort, when merging two sequences of length $\ell$ each, we have $2\ell$ tasks. These $2\ell$ tasks find the position of each element in the two merged seuqences in the combined sequence of $2\ell$ elements. These $2\ell$ tasks are also completely dependent in the way they are written. However, a rewrite is possible.

Let us call the two sorted sequences as $A$ and $B$. Think of searching for each element of $A$ in $B$ and vice-versa. Since the sequences $A$ and $B$ are sorted, one can use binary search. Still there are $2\ell$ tasks but these $2\ell$ tasks are independent of each other. Once these tasks finish, one can see that element $A[i]$ from $A$ can be placed at index $i'$ where $i'= i + Rank(A[i], B)$. In the former expression, $Rank(A[i], B)$ refers to the rank of element $A[i]$ in the array $B$ obtained using binary search.)

isuue7

ShivamMangale commented 5 years ago

fixed commit id: 3d9cfc6