mark smith

Ranch Hand

Posts: 258

posted 9 years ago

hi

i try to feed a recursive structure from a map

an expresionn

(x>1) and (y>2 or z<4)

in the map i have this information

idInfo idMere nom

1 1 and

2 1 x>1

3 1 or

4 3 y>2

5 3 z<4

now i try to feed the data structure: info searchInfo from the map

data in the map are not necessarily in order, so that it's more complex to feed the structure

any idea to start?

[ May 22, 2008: Message edited by: mark smith ]

i try to feed a recursive structure from a map

an expresionn

(x>1) and (y>2 or z<4)

in the map i have this information

idInfo idMere nom

1 1 and

2 1 x>1

3 1 or

4 3 y>2

5 3 z<4

now i try to feed the data structure: info searchInfo from the map

data in the map are not necessarily in order, so that it's more complex to feed the structure

any idea to start?

[ May 22, 2008: Message edited by: mark smith ]

Bill Shirley

Ranch Hand

Posts: 457

posted 9 years ago

Lots of issues here.

Data structures are not recursive. Algorithms are recursive (or not).

Some terms from graph theory that correspond to some data structures. Trees are a subset of graphs.

I would personally suggest against using an array, preferably use a List/ArrayList.

What are

idInfo

idMere

and

nom

intended to

The items you list are definitely in a stack order.

The whole string has been parsed.

A x B pushes x, then A, then B onto the stack,

A, B = boolean tests,

x = boolean conjunction

subprocessing (prob'ly recursively) each A & B

thus

(x>1) and (y>2 or z<4)

A = (x>1)

x = and

B = (y>2 or z<4)

push x - "1 1 and"

process A = push A - "2 1 x>1"

process B...

this time

A = y>2

x = or

B = z<4

...

pop the items (from the bottom, the way they're written),

and process them,

it should look like this when done...

Data structures are not recursive. Algorithms are recursive (or not).

Some terms from graph theory that correspond to some data structures. Trees are a subset of graphs.

I would personally suggest against using an array, preferably use a List/ArrayList.

What are

idInfo

idMere

and

nom

intended to

*mean*?The items you list are definitely in a stack order.

The whole string has been parsed.

A x B pushes x, then A, then B onto the stack,

A, B = boolean tests,

x = boolean conjunction

subprocessing (prob'ly recursively) each A & B

thus

(x>1) and (y>2 or z<4)

A = (x>1)

x = and

B = (y>2 or z<4)

push x - "1 1 and"

process A = push A - "2 1 x>1"

process B...

this time

A = y>2

x = or

B = z<4

...

how to start?

pop the items (from the bottom, the way they're written),

and process them,

it should look like this when done...

Bill Shirley - bshirley - frazerbilt.com

if (Posts < 30) you.read( JavaRanchFAQ);

Garrett Rowe

Ranch Hand

Posts: 1296

posted 9 years ago

I disagree, a data structure can be recursive.

[ May 23, 2008: Message edited by: Garrett Rowe ]

**Bill Shirley : Data structures are not recursive. Algorithms are recursive (or not).**

I disagree, a data structure can be recursive.

[ May 23, 2008: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter