University of Lahore, Sargodha Campus: "Assignment N0 2"

You might also like

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

UNIVERSITY OF LAHORE, SARGODHA

CAMPUS

“ASSIGNMENT N0 2”

NAME HAMNA AWAN


SECTION B
SUBJECT DSA
REG NO BSCS07193114

Q1: infix and postfix expression of b2 +4ac


Infix & Postfix of b2-4ac:
Infix Expression: b^2 - 4*a*c

Postfix Expression: b2^4ac**-

Infix & Postfix of a2+ b2-2ab:


Infix Expression: a^2 + b^2 - 2*a*b

postfix Expression: a2^ b2^ + 2ab**-

Infix & Postfix of a3+ b3+2ab2+2a2b:


Infix Expression: a^3 + b^3 + 2*a*b^2 + 2*a^2*b

Postfix Expression: a3^b3^+ 2ab2^**+2a^*2b*+

Shell sort:
Shell sort is an algorithm that first sorts the elements far apart from each other and successively
reduces the interval between the elements to be sorted. It is a generalized version of insertion sort.

Quick Sort:
Quick sort is a highly efficient sorting algorithm and is based on partitioning of array of data into smaller
arrays. A large array is partitioned into two arrays one of which holds values smaller than the specified
value, say pivot, based on which the partition is made and another array holds values greater than the
pivot value.

Radix Sort:
Radix sort is a sorting technique that sorts the elements by first grouping the individual digits of the
same place value. Then, sort the elements according to their increasing/decreasing order. Suppose, we
have an array of 8 elements. First, we will sort elements based on the value of the unit place. Then, we
will sort elements based on the value of the tenth place. This process goes on until the last significant
place.

Bucket Sort:
Bucket sort, or bin sort, is a sorting algorithm that works by distributing the elements of an array
into a number of buckets. Each bucket is then sorted individually, either using a
different sorting algorithm, or by recursively applying the bucket sorting algorithm.

You might also like