Question: Programming Assignment Part 2 Using the same JSFiddle we will add one more button and Text Box. The button will be Search. Clicking the button
Programming Assignment Part 2 Using the same JSFiddle we will add one more button and Text Box. The button will be Search. Clicking the button will search the array and output the first index where the value entered in the Text Box is found. This will be done by calling a function SearchArray (function SearchArray(array, value)).
The name of the function will be SearchArray. Argument 1 is the array, argument 2 is the value you are searching for within the array. Each time the program compares 2 numbers you must count it as an operation (only count comparisons). Output the total number of operations to find the first occurrence of the number searched or value not found. State using Big O Notation your time complexity and be prepared to justify your answer. This should be output in your actual JSFiddle.
Remember: You also need to put in the time complexity. This is NOT HARD This is not a trick question, you will give a simple Big O notation of the time complexity of the search and the insertion on your html page. ( example
Complexity: O ___
Information:
There should be 4 TextBoxes I recommend naming them (id = name) tbArraySize, tbInsertValue, tbInsertIndex, tbSearchValue. You can use your own naming scheme but it is important you have a naming scheme. You will have 3 buttons; Create Array, Insert Into Array, Search Array I recommend naming them btnCreate, btnInsert, and btnSearch.
Sample Input

Sample Output
| Array output (100 items): 11,64,39,97,69,28,94,49,31,45,9,29,65,53,31,58,100,81,79,24,99,27,39,58,35,39,10,24,98,26,84,70,42,93,17,69,69,17,12,4,21, 75,86,25,82,32,69,21,42,24,42,100,61,25,97,60,12,100,40,40,10,75,78,86,25,3,11,65,44,17,35,4,78,77,53,5,53,18,19,26,31,51, 6,68,58,49,54,27,58,6,98,51,79,21,32,38,34,35,83,70 Value 99 inserted at location 20 there were 80 operations performed in this insertion The time complexity of this algorithm is use big O notation Value 99 found at location 20 there were 20 comparison operations performed in this search The time complexity of this algorithm is use Big O Notation |
The html code to create the form is (you can use this)
| Enter Array Size: |
| Enter Location: Enter Value to Insert: |
| Enter Value to Find: |
Please integrate the HTML code so the buttons function accordingly. Thank you!
Enter Array Size:100 Create Array Enter Location: 5 Enter Value to Insert: 99 Insert Into Array Enter Value to Find: 20 Search Array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
