473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Find indexes in 2d array with if parameters

I am trying to find indexes in a 2D array where the number x is either larger than the numbers left and right, and smaller than the numbers above and below, or vice versa.
Mar 3 '17 #1

✓ answered by dev7060

A general algorithm may be:

1: Input the 2D array.

2: Start a loop to initialise the values of array from [0][0] to [0][1]...

3:
Another loop to extract array values
{
-Checking if the value of current element a[i][j] is the largest in current horizontal row (keeping 'i' same)

If so
{ Copy the value of 'j' to another variable.

Now keeping the 'j' same, check whether the current element has the lowest value in its column or not( [0][5], [1][5],...).
If yes, copy the value of 'i' to another variable.}

Now print the value of array element using array[new_var_1][new_var_2] and the new variable's values will be the indices values.
}

1 1239
dev7060
633 Expert 512MB
A general algorithm may be:

1: Input the 2D array.

2: Start a loop to initialise the values of array from [0][0] to [0][1]...

3:
Another loop to extract array values
{
-Checking if the value of current element a[i][j] is the largest in current horizontal row (keeping 'i' same)

If so
{ Copy the value of 'j' to another variable.

Now keeping the 'j' same, check whether the current element has the lowest value in its column or not( [0][5], [1][5],...).
If yes, copy the value of 'i' to another variable.}

Now print the value of array element using array[new_var_1][new_var_2] and the new variable's values will be the indices values.
}
Mar 5 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: wayne mcfadden | last post by:
Hi, I'm stumped. Our text extenders stopped working on one database. I think that i'm missing something simple here. The column is enabled... but when you do an index status it doesn't know...
1
by: Sampath Reddy | last post by:
Hi Everybody, We are using UDB v8.1 I will explain about my Stored procedures which we are executing in UDB AIX box. We have 3 millions(apporox) of data in 22 tables. By applying the business...
12
by: Gus | last post by:
Hi, I´m triying to invoke a member using reflection, but this member requiere two parameters, the first patrameter is a string and the second is a reference to a dataset (output parameter). The...
12
by: gcary | last post by:
I am having trouble figuring out how to declare a pointer to an array of structures and initializing the pointer with a value. I've looked at older posts in this group, and tried a solution that...
3
by: 001frien | last post by:
How do i find indexes of the columns of all the tables of the datbase...........most importantly in SQL server 2000 Thanks a lot
6
by: Queez | last post by:
I've had a good look around and no-one seems to have mentioned this, which leads me to believe that I may be missing something simple. Basically, is there a way I can do the following, and if so,...
3
by: JJ | last post by:
I am using a handler (processImage.ashx) to display an image. The image is displayed according to parameters passed in the querystring. The handerl is called via some clientside javascript. I...
1
by: alfiecrosby | last post by:
Hi... this is my first time ti post here... I have a question regarding my PHP study... How do I find out if an array has values posted to each of its elements? I need to know that EVERY...
4
by: uidzer0 | last post by:
Hey everyone, I apologize in advance for this novice question however I'm not having any luck finding the answer myself. I'm attempting to loop through an array of structures passed to a...
8
by: Jeff | last post by:
I have an array; $array = 'something'; $array = 'something else'; I can do this: echo $array; And I can do this: $content =<<<content
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.