Skip to content

UMK-Data-Science/searching-technique

Repository files navigation

Tutorial Week 9 - Searching Algorithm

Please answer all questions and read carefully :octocat:

Instructions

This tutorial consists with 3 questions. Try to complete this tutorial by commit your changes and read the questions carefully 😄

Exercise 1

Given an array arr[]={10, 20, 80, 30, 60, 50, 110, 100, 130, 170}, write a C program to search value 110 in unsorted arr[].

Input:
arr[] = {10, 20, 80, 30, 60, 50, 110, 100, 130, 170}
Output:
Element with value 110 is present at index 6

Exercise 2

Given an array arr[]={10, 20, 80, 30, 60, 50, 110, 100, 130, 170}, write a C program to search value 200 in unsorted arr[].

Input:
arr[] = {10, 20, 80, 30, 60, 50, 110, 100, 130, 170}
Output:
Element with value 200 is not present in arr[]

Exercise 3

Given an array arr[]={10, 20, 30, 40, 50, 60, 70}, write a C program to search value 45 in sorted arr[] (Note: use technique sequential search for sorted list/array)

Input:
arr[] = {10, 20, 30, 40, 50, 60, 70}
Output:
Element with value 45 is not present in arr[]

Exercise 4

Given an array arr[]={10, 20, 30, 40, 50, 60, 70}, write a C program to search value 50 in sorted arr[] (Note: use technique sequential search for sorted list/array)

Input:
arr[] = {10, 20, 30, 40, 50, 60, 70}
Output:
Element with value 50 is present at index 4

Exercise 5

Given an array arr[]={10, 20, 30, 40, 50, 60, 70}, write a C program to search value 50 in sorted arr[] (Note: use technique binary search for sorted list/array)

Input:
arr[] = {10, 20, 30, 40, 50, 60, 70}
Output:
Element with value 50 is present at index 4

Exercise 6

Given an array arr[]={10, 20, 30, 40, 50, 60, 70}, write a C program to search value 45 in sorted arr[] (Note: use technique binary search for sorted list/array)

Input:
arr[] = {10, 20, 30, 40, 50, 60, 70}
Output:
Element with value 45 is not present in arr[]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages