0% found this document useful (0 votes)
78 views10 pages

PST Solbank U4

The document discusses various problem solving techniques including merging, sorting, and searching algorithms. It defines sorting as ordering a list of elements in ascending or descending order. Some sorting techniques mentioned are selection sort, exchange sort, insertion sort, diminishing increment sort, and partitioning sort. Searching is defined as finding a required element in a data structure. Binary and linear searches are discussed. Text processing techniques like text line adjustment, keyword searching, and linear pattern searching are also summarized.

Uploaded by

ANTENNA FF
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)
78 views10 pages

PST Solbank U4

The document discusses various problem solving techniques including merging, sorting, and searching algorithms. It defines sorting as ordering a list of elements in ascending or descending order. Some sorting techniques mentioned are selection sort, exchange sort, insertion sort, diminishing increment sort, and partitioning sort. Searching is defined as finding a required element in a data structure. Binary and linear searches are discussed. Text processing techniques like text line adjustment, keyword searching, and linear pattern searching are also summarized.

Uploaded by

ANTENNA FF
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/ 10

Soundarya Institute of Management and Science

CA-C2T: PROBLEM SOLVING TECHNIQUES


UNIT - 4 [12 Hours]
Merging: the two-way merge. Sorting: Sorting by selection, sorting by exchange, sorting by insertion, sorting by
diminishing increment, sorting by partitioning. Searching: binary search, hash search. Text processing and Pattern
searching: text line length adjustment, keyword searching in text, text line editing, linear pattern search

Two Mark Questions


1. Define searching?
The process of finding the required element in a data structure is called searching.
The different type of searching methods are: (a) Linear search and (b) Binary search.
2. Define sorting?
Sorting is a process of ordering or placing a list of elements from a collection in ascending or
descending order. The different types of sorting methods are (a) Bubble sort (b) Shell sort (c)
Quick sort (d) Insertion sort (e ) Selection sort (f) Heap sort (g) Merge sort etc.

3. List any 4 sorting techniques.


Sorting by selection – Selection sort
Sorting by exchange – Bubble sort
Sorting by diminishing increment – Shell sort.
Sorting by Partitioning – Quick sort

4. Difference between Linear and Binary search?


LINEAR SEARCH BINARY SEARCH
1. It can be applied for both 1. This should be applied only
sorted and un sorted array. for sorted array
2. It is not much effective and 2. It is more effective and
less complex more complex
3. Sequential search is needed 3. Divide and conquer process
in this technique is needed in this technique

4. What do you mean by keyword searching?.


Counting the number of times a particular word occurs in a given text is called keyword searching.
Ex: GALS BANGALORE IS BEAUTIFUL CITY
Key : “GAL” Occurrence = 2
5. Explain text line adjustment with an example.
The capability to change the text alignment of a block of text either Left justified or Right justified
is known as text line adjustment.
Ex: My Name is Sharadhi (Left justified)
My Name is Sharadhi (Right justified)
6. What is hashing?
Hashing is a technique or process of mapping keys,
values into the hash table by using a hash function. 0
1
HASH FUNCTION HASH 2
KEY
VALUE
3

Long Answers ( 4M / 5M / 8 M Questions )


1. Write a note on Text line editing.
Searching a line of text for a given pattern or substring and then replacing with another given
pattern is called Text line editing.
Ex: Replace “wrong” by the “right” in the line
Original line : two wrongs in this line are wrong
pattern = wrong replacement = right
Edited line : two rights in this line are right

2. Write a note on Pattern searching.


The process of searching a particular pattern in the string is called Linear Pattern searching.
Ex: String : COLLEGE
Pattern : LEG
String COL OLL LLE LEG
Pattern LEG LEG LEG LEG
Comparison C#L O#L L#L L == L
O#E L#E L#E E== E
L#G L#G E#G G == G
Count 0 0 0 1
Read C functions (as Pseudocode) on all the sorting technique
from your Practical manual.
Also learn the tracing of the sorting techniques from the
below examples.
3. Trace the values using Bubble sorting technique ( 28 , 20 , 30 , 15 , 05 )
4. Trace the values using Insertion Sorting technique (75, 8, 1, 16, 48, 3, 7, 0)

5. Trace the values using Selection Sorting technique ( 75, 8, 1, 16, 48, 3, 7, 0)
6. Trace the values using Quick sorting technique (45, 46, 15, 92, 35, 71)
7. Trace the values using Merge sorting technique [ 35, 10, 15, 45, 25, 20, 40 ]
8. Trace the values using heap sort [ 9, 16, 32, 8, 41, 5, 80]
9. Trace the values using Shell sort ( 23, 12, 67, 44, 11, 99, 55)

You might also like