Question about Computers & Internet

1 Answer

Binary search example program in finding a value in multidimensional array in binary search

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that got 5 achievements.

    Novelist:

    An expert who has written 50 answers of more than 400 characters.

    Scholar:

    An expert who has written 20 answers of more than 400 characters.

  • Expert
  • 160 Answers

Here's a nice article with some examples.

http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary

And another - examples at the end of long boring explanations:

http://en.wikipedia.org/wiki/Binary_search

If you still have problems, tell me what language you're using.

Posted on Jul 18, 2008

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Describe the difference between binary semaphores and counting semaphores.


Binary semaphore is a semaphore with the integer value ranges over 0 and 1 whereas the counting semaphore's integer value ranges over unrestricted domain. Binary semaphores are easier to implement comparing with the counting semaphore.
Binary semaphore allows only one thread to access the resource at a time. But counting semaphore allows N accesses at a time.
The 2 operations that are defined for binary semaphores are take and release.
The 2 operations that are defined for counting semaphores are wait and signal

Sep 25, 2016 | Computers & Internet

1 Answer

What are the arguments uses by c language and types of arguments


The arguments that are passed to a c program are argc and argv, they are passed to main as:
int main ( int argc, char **argv )
argc is a number which holds how many arguments were passed.
argv is an array of arrays which holds the text values of each of the arguments passed to the program.

For example to get the first argument passed to the program you can access it as argv[1] and treat it just as you would treat any char *. Note that argv[0] always contains the name of the program and is not counted in argc.


Hope this helps, and thank you for using FixYa.

Chartreuse,

Jan 28, 2011 | Computers & Internet

2 Answers

Merging two arrays and sort them


NEED A NEW KEY THE ONE ON THE BOX WONT WORK

Jul 29, 2009 | Microsoft Windows XP Professional With...

1 Answer

Visual basic program for binary search technique


This sounds like "homework".

A binary-search requires an "ordered" table of values.
Sort your values into the proper order.

LET TOP=1; * Point to first element in the table.
LET BOT=1000; * Point to the *LAST* item in the table.

LOOPHERE:

LET BINARY = 2;

LET MIDDLE=FLOOR((TOP+BOT)/BINARY);

IF VALUE(MIDDLE) = KEY THEN STOP;

IF KEY < VALUE(MIDDLE)
THEN TOP = MIDDLE;
ELSE BOTTOM = MIDDLE;

IF TOP = BOTTOM THEN STOP;

GOTO LOOPHERE;

END;

Mar 08, 2009 | Microsoft Windows Vista Home Premium with...

1 Answer

Iwant prroject


dont search using mp3 keyword, if you upload your files in binary mode will be enough.
try searching for "binary file upload/download using java"
you can find a lot of binary file uploads projects.
this will upload your mp3 and any other files as well.

Jan 31, 2009 | Microsoft Windows XP Professional

1 Answer

Factorial


1.In mathematics, the factorial of a non negitive integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
c018852104089c3b86ad5bba9e9223f9.png and4870ed458b29bbc1925d3466e81e4b0d.png2. Algorithm to find factorial of 6
1. Start
2. Take two variables i and j.
3. Take a constent VALUE=6.
4. Put i=1,j=1.
5. If i is less than VALUE goto 6 else goto 7
6. j=j*i and goto step 5
7. Print j value.
8. Stop.
/* Program to find factorial of 6 */

#include <stdio.h>

#define VALUE 6
int i,j;

void main()

{

j=1;

for (i=1; i<=VALUE; i++)

j=j*i;

printf("The factorial of %d is %d\n",VALUE,j);

}

Jan 19, 2009 | Computers & Internet

1 Answer

Programming in c


To convert numbers you can use the printf() function
printf("%d", x'FF') hex to decimal
printf("%o", x'FF') hex to octal

If you want to save the value in another variables use sprintf
e.g

a = x'FF';
b = sprintf("%d",a)


Jan 15, 2009 | Computers & Internet

1 Answer

Flex Grid


The most common multidimensional array, the two dimensional array table, is best presented to your users in row and column format. The grid control offers a convenient way for you to display table data to your users. The users can navigate the table's values using scrollbars. Therefore, the grid control does not have to be as large as the table, because the grid control automatically displays scrollbars.
To add the flex grid control to your toolbox, select project and components. Add the flex grid control:
lesson97-1.jpg Once it is added, you will see the yellow flex grid control in your toolbox:
lesson97-2.jpg When you place the grid control on your form, you will have to resize it before the control takes on a tabular appearance. As you expand the size of the control, it does not look to much like a table. The problem is that the table's default number of rows and columns are two. To fix this problem, you must configure the rows and columns in the properties window:
lesson97-3.jpg lesson97-4.jpg lesson97-5.jpg The grid control supports fixed rows and columns. These refer to rows and columns in a grid control that do not scroll when the user clicks the scrollbars. The fixed rows and columns provides labels that describe the data. The fixed rows and columns are often called row and column headers.
lesson97-6.jpg When working with the grid control, much code is needed to provide the grid with functionality. Call statements are used to break the code required by the grid control into smaller, more manageable procedures. This is referred to as modular programming (which refers to the practice of placing code with a single purpose in a general subroutine procedure and then calling the code from a second procedure.)
Here is the code for the form load procedure (this example is based on the computer disk example used in the last lesson)


Private Sub Form_Load()
Call SizeCells
Call CenterCells



grdGrid.Row = 0
grdGrid.Col = 1
grdGrid.Text = "Single Sided; Low Density "
grdGrid.Col = 2
grdGrid.Text = "Double Sided; Low Density"
grdGrid.Col = 3
grdGrid.Text = "Singled Sided; High Density"
grdGrid.Col = 4
grdGrid.Text = "Double Sided; High Density"

grdGrid.Row = 1
grdGrid.Col = 0
grdGrid.Text = "3 1/2 inch"
grdGrid.Col = 1
grdGrid.Text = "$2.30"
grdGrid.Col = 2
grdGrid.Text = "$2.75"
grdGrid.Col = 3
grdGrid.Text = "$3.20"
grdGrid.Col = 4
grdGrid.Text = "$3.50"



grdGrid.Row = 2
grdGrid.Col = 0
grdGrid.Text = "5 1/4 inch"
grdGrid.Col = 1
grdGrid.Text = "$1.75"
grdGrid.Col = 2
grdGrid.Text = "$2.10"
grdGrid.Col = 3
grdGrid.Text = "$2.60"
grdGrid.Col = 4
grdGrid.Text = "$2.95"

End Sub
Notice how the form load procedure is used to populate the cells in the grid control. To control cell size and cell alignment, two smaller procedures are created and each procedure is called by the form load procedure.


Private Sub SizeCells()
Dim intColumn As Integer

grdGrid.ColWidth(0) = 1100

For intColumn = 1 To 4
grdGrid.ColWidth(intColumn) = 2200
Next intColumn

End Sub

Private Sub CenterCells()
Dim intColumn As Integer

For intColumn = 1 To 4
grdGrid.ColAlignment(intColumn) = flexAlignCenterCenter
Next intColumn

End Sub

Notice that the size and alignment procedures are only applied to columns 1 through 4. Column 0, which is a fixed column reserved for labels, is not formatted using either of the above two procedures.
Here is the final result:
lesson97-7.jpg

Mar 26, 2008 | Computers & Internet

1 Answer

Programming


This sounds remarkably like a homework assignment type of question. Any C++ reference book will contain examples of this. Also, look for books about data structures which will contain not only examples of the above, but complete explanations of the concepts and uses of each.
Dan

Mar 24, 2008 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

64 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

98770 Answers

David Payne
David Payne

Level 3 Expert

14065 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...