Tree creation algorithm needed. Experts pls help
hi,
I'm writing a program that read data from database to create a Tree.
The database table:
DATA PREDATA POSTDATA
1 4 5
2 6 7
3 1 2
4 8 9
If the DATA has a PREDATA, it will be inserted into the left node otherwise null and POSTDATA will be inserted into right node. For example if I pass in 3 the Tree should look like the following:
3
1 2
4 5 6 7
8 9 null null null
Thanks
This is a fairly straighforward problem but I see two possible problems.
1) There could be more than one root. Any row with identifier that is never used as pre or post is a root.
2) If a row identifier is used more than once as pre or post then one no longer has a simple binary tree.
Dealing with 1) is easy - just have a set of roots. Dealing with 2) is not so easy.
My solution follows. It deals with 1 but not 2.
import java.util.*;
public class Test20040622
static String[][] testData =
{"1","4","5"},
{"2","6","7"},
{"3","1","2"},
{"4","8","9"},
static class TreeElement
TreeElement(String value, Object pre, Object post)
this.value = value;
this.pre = pre;
this.post = post;
public String toString()
return value;
String value;
Object pre;
Object post;
private Set treeRoots;
public Test20040622()
HashMap map = new HashMap();
// Build a map pointing from id to TreeElement
for (int rowIndex = 0; rowIndex < testData.length; rowIndex++)
String[] row = testData[rowIndex];
map.put(row[0], new TreeElement(row[0], row[1], row[2]));
// The set of keys to the TreeElements
treeRoots = new HashSet(map.keySet());
// Go through each of the elements replacing the
// pre and post String with the corresponding TreeElement
for (Iterator it = map.values().iterator(); it.hasNext();)
TreeElement treeElement = (TreeElement)it.next();
if (treeElement.pre instanceof String)
treeRoots.remove(treeElement.pre);
Object pre = map.get(treeElement.pre);
if (pre != null)
treeElement.pre = pre;
if (treeElement.post instanceof String)
treeRoots.remove(treeElement.post);
Object post = map.get(treeElement.post);
if (post != null)
treeElement.post = post;
// Convert the tree root Strings to TreeElements
HashSet roots = new HashSet();
for (Iterator it = treeRoots.iterator(); it.hasNext();)
roots.add(map.get(it.next()));
treeRoots = roots;
public void print()
for (Iterator it = treeRoots.iterator(); it.hasNext();)
printOne(it.next(), 0);
private void printOne(Object leaf, int level)
if (leaf instanceof TreeElement)
printOne( ((TreeElement)leaf).pre, level+1);
for (int i = 0; i < level; i++)
System.out.print(" ");
System.out.println(leaf);
if (leaf instanceof TreeElement)
printOne(((TreeElement)leaf).post, level+1);
public static void main(String[] args)
new Test20040622().print();
}
Similar Messages
-
QUERY CLARIFICATION RQD : gurus, experts pls help
Hai,
I am facing problem in performance of the query. sample scenario i have created here pls help me to solve
**VEH_MAIN* TABLE (MASTER TABLE)*
CREATE TABLE VEH_MAIN
( VIP_MOT_IND VARCHAR2(10 BYTE),
VIP_IND NUMBER(10,0)
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',5);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('M0T03',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',2);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',6);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',3);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',4);
**VEH_ENGINE_SUB* (table for engine subclass)*
CREATE TABLE VEH_ENG_SUB
( ENG_SUBCLASS VARCHAR2(50 BYTE),
ENG_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT01');
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT02');
*VEH_ENG_IND( Detail table for engine subclass)*
CREATE TABLE VEH_ENG_IND
( "ENG_SUBCLASS" VARCHAR2(50 BYTE),
"ENG_IND" VARCHAR2(10 BYTE)
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','1');
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','2');
*VEH_AXIS( Master table for Engine Axis)*
CREATE TABLE VEH_AXIS
( ENG_AXIS VARCHAR2(50 BYTE),
AXIS_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS001','MOT01');
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS002','MOT02');
*VEH_AXIS_IND( Details table for engine axis)*
CREATE TABLE VEH_AXIS_IND
( ENG_AXIS VARCHAR2(50 BYTE),
ENG_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','1');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','2');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','3');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','4');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','5');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','6');
Condition 1
if i select only ENGINE_SUBCLASS='ENGSUB001' then
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )output is
MOT01 1
MOT01 2
Condition 2:if i select only the Engine Axis='ENGAXIS002' then the
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002';MOT02 5
MOT02 6
Condition 3:
BOTH ENGINE AXIS AND ENGINE SUBCLASS
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
AND ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');Null values returned. this is correct.
But the query PERFORMANCE fails in OR CONDITON as below
Condition 4;
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
OR ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');output
MOT02 5
MOT02 5
MOT02 5
MOT02 5
MOT02 6
MOT02 6
MOT02 6
MOT02 6
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
This is sample example. when i implement in huge table with partition this scennario takes much time even 2 hours to run.
i want the output must be as below if i use OR condition like condition 4
MOT01 1
MOT01 2
MOT02 5
MOT02 6
Gurus and experts pls help me to solve this problem. Dont give any suggestion like
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002'
union
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
}this will give correct result...
MOT01 1
MOT01 2
MOT02 5
MOT02 6
but the problem is we cannot implement this in query. because query get framed at runtime there will be so many implement has to be done. other than UNION pls give me more suggesion
waiting..
S
Edited by: A Beginner on Sep 11, 2010 12:51 AMcreate a view v1 with all the joins
select * from v1 where eng_subclass='ENGSUB001'
union
select * from v1 where eng_axis='ENGAXIS002'
If you really do not like the direct access with union, try this
select * from v1
where vsub_PK in (select vsub_PK from v1 where eng_subclass='ENGSUB001' )
OR vsub_PK in (select vsub_PK from v1 where eng_axis='ENGAXIS002')
--vsub_PK is the primary key of table vsub -
Any java experts pls help me in converting attribute to XML formats
Pls help me oh my god i am a newbie here and i am given this project.
I had just written a XML doc. which looks like this
<ConsumerTransfer>
<TransactionId>
123:123
</TransactionId>
<Billingoption>
cash
</Billingoption>
</ConsumerTransfer>
I need to make this to attributes like
private String TransactionId()
private String BillingOption()
and so on.....
I need to convert this attributes to XML format
can any show me an example or the source codes for this
Really, I appreciate it.
JimmyKnotFor such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
salut -
Hi experts pls help me with this materialized view refresh time!!!
Hi Expeerts ,
Please clarify my doubt about this materialized view code
[\n]
CREATE MATERIALIZED VIEW SCHEMANAME.products_mv
REFRESH WITH ROWID
AS SELECT * from VIEW_TABLE@DATAOPPB;
[n]
Here i am creating a materialized view named products_mv of the view_table present in the remote server.Can anyone tell me when will my table product_mv will get refreshed if i follow this code.As what i read from the books is that the refresh period is implicit and is carried out by the database implicitly.so can u tell me suppose i insert 2 new records into my view_table when will this record get updated into my product_mv table.
I cant use primary key approach so this is the approach i am following .Kindly help me in understanding when will refresh of records occur in the materialized view product_mv...Pls help
regards
debashisHi Justin ,
Yes, my database can reasonably schedule other jobs too .Its not an issue.
Actually what i meant "fine in all aspects" is that will the matrerialized view will get refreshed w.r.t the documetum_v table present in my remote server.This is all i need to refresh my materialized view .
I queries the DBA_JOBS table .I could see the following result i have pasted below:-
[\n]
NLS_ENV
MISC_ENV INSTANCE
dbms_refresh.refresh('"WORKFLOW"."PRODUCTS_MV2"');
JOB LOG_USER PRIV_USER
SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE
NEXT_SEC TOTAL_TIME B
INTERVAL
FAILURES
WHAT
[n]
here WORKFLOW"."PRODUCTS_MV2 is the materialized view i have created.So can u tell me that whether we can predict our refresh part is functioning fine from this data.If so how?
Actually i am asking u in details as i dont have much exposure to materialized view .I am using it for the very first time.
Regds
debashis -
BB Curve 8320 Software needed! pls help
Im a BB 8320 Curve user. Software version 4.2.2.180 (Platform 2.5.0.36) T-mobile user. I need to download this version bcoz i've upgraded to OS 4.5 but im didnt liked dat much. So i want to switch to 4.2.2.180 (Platform 2.5.0.36) but didnt get this version anywhere. Pls help me friends...!!!
Solved!
Go to Solution.Hi and Welcome to the Forums!
All carriers official versions are available via this portal:
http://na.blackberry.com/eng/support/downloads/download_sites.jsp
I've no idea which carriers have the version you desire...you'll have to dig through to find it.
Good luck!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Hi All
following is my code. It_bseg table have the following records
Bukrs Blart Aufnr hkont amount
010 |0001801059| |0000461100|10-DE-080006| 31325.57|
010 |0001801059| |0000461100|10-DE-080007| 31325.57
010 |0001801059| |0000461100|10-DE-080008| 31325.58
010 |0001801063| |0000461100|10-ML-080010| 282.24
010 |0004011697| |0000461100|10-MC-082000| 10000.00
I need all the records
But i got the following records only
Bukrs Blart Aufnr hkont amount
010 |0001801059| |0000461100|10-DE-080006| 31325.57|
010 |0001801063| |0000461100|10-ML-080010| 282.24
010 |0004011697| |0000461100|10-MC-082000| 10000.00
Pls help me.
FORM get_data.
Extract Data from BKPF table
SELECT bukrs budat gjahr belnr monat blart waers
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND blart IN s_blart
AND budat IN s_budat.
SORT it_bkpf by belnr ascending.
IF NOT it_bkpf[] IS INITIAL.
Extract Data from BSEG table
SELECT bukrs belnr werks hkont aufnr dmbtr sgtxt
INTO TABLE it_bseg
FROM bseg
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-belnr
AND GJAHR = it_bkpf-gjahr
AND valut = it_bkpf-budat
AND bukrs = p_bukrs
AND werks = p_werks
AND hkont IN s_hkont
AND aufnr IN s_aufnr.
AND shkzg = 'H'.
ENDIF.
SORT it_bseg by belnr ascending.
DELETE ADJACENT DUPLICATES FROM it_bseg.
LOOP AT it_bkpf.
READ TABLE it_bseg WITH KEY
belnr = it_bkpf-belnr BINARY SEARCH.
IF sy-subrc = 0.
it_detail-budat = it_bkpf-budat.
it_detail-period = it_bkpf-budat+0(6).
it_detail-hkont = it_bseg-hkont.
it_detail-aufnr = it_bseg-aufnr.
it_detail-sgtxt = it_bseg-sgtxt.
it_detail-blart = it_bkpf-blart.
it_detail-dmbtr = it_bseg-dmbtr.
it_detail-waers = it_bkpf-waers.
APPEND it_detail.
CLEAR it_detail.
ENDIF.
ENDLOOP.Hello Kumar-
Code below.
FORM get_data.
Extract Data from BKPF table
SELECT bukrs budat gjahr belnr monat blart waers
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND blart IN s_blart
AND budat IN s_budat.
*SORT it_bkpf by belnr.
IF NOT it_bkpf[] IS INITIAL.
Extract Data from BSEG table
SELECT bukrs belnr werks hkont aufnr dmbtr sgtxt
INTO TABLE it_bseg
FROM bseg
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-belnr
AND GJAHR = it_bkpf-gjahr
AND valut = it_bkpf-budat
AND bukrs = p_bukrs not required
AND werks = p_werks
AND hkont IN s_hkont
AND aufnr IN s_aufnr.
AND shkzg = 'H'.
ENDIF.
SORT it_bseg by belnr .
DELETE ADJACENT DUPLICATES FROM it_bseg. not required
***Changes done by srini
loop at it_bseg into wa_bseg.
collect wa_bseg into it_final.
endloop.
Cheers,
~Srini.. -
URGENT, EXPERTS PLS HELP!!
I would like to know answer to following question:
"Is java.lang.Object" overused??? Pls reply immediately coz I doing my final year project at ivy league university and I need to hand in my assignment in next 2 hours!"Is java.lang.Object" overused??? Pls reply
immediately coz I doing my final year project at ivy
league university and I need to hand in my assignment
in next 2 hours!I love the story this implies. This issue is critical to a final year project? A final year project? Due in September?
How could it be relevant? I mean, if the final year project is an argument about the overuse of a particular idiom, then presumably the project is in the OP's area of expertise. So why is he asking about it here, now?
And if it's not his area of expertise... then he'd be expected to do some research, such as interviews. He'd be expected to do some research somewhat earlier than two hours before the project is due.
And of course the coup de grace, informing us that it's in an ivy league school. Those of us who weren't so fortunate to attend one, are of course obligated to help out those who do.
He must go to Yale.
Otherwise...a marvelous troll, sir! -
Urgent Help is needed : Experts please help
Does modification of Transfer rule and update rule require data deletion from all the dependent data targets?
Hi Experts,
Two new key figures have been added in data source and subsequently in transfer rules, updated rules, ODS and cubes there in data flow.
The changes are supposed to move in production on this weekend. I am afraid; does this activity require data deletion from the data targets before moving the transports?
With out deletion of the data can these transports be moved in prod?
Please reply with your valuable advice.
Points will be rewarded.
Thanks,
BW USERhi,
hope u might have to do changes in the cube and ods also rite?
and you need to have data for the added key figure in the cube/ods for the already existing records in the cube/ods.for this you copy content in other cube/ods and do delete and reload the data to the new changed cube/ods.
Ramesh -
Needed urgently pls help me if anybody knows
my output has to look like this please help me
name city cardno mobno count
sha chennai 12344 35545 2
raj chennai 12344 13244
sur bombay 12445 343 1
raj banglore 12244 24657 1
total count 4
according to the city and card no i need the output
i need a output like this
Edited by: user10464977 on Oct 23, 2008 4:27 AMuser10464977 wrote:
my output has to look like this please help me
name city cardno mobno count
sha chennai 12344 35545 2
raj chennai 12344 13244
sur bombay 12445 343 1
raj banglore 12244 24657 1
Please :
SQL> select 'sha' name, 'chennai' city, 12344 cardno, 35545 mobno, 2 "count" from dual union all
2 select 'raj' name, 'chennai' city, 12344 cardno, 13244 mobno, null "count" from dual union all
3 select 'sur' name, 'bombay' city, 12445 cardno, 343 mobno, 1 "count" from dual union all
4 select 'raj' name, 'banglore' city, 12244 cardno, 24657 mobno, 1 "count" from dual;
NAM CITY CARDNO MOBNO count
sha chennai 12344 35545 2
raj chennai 12344 13244
sur bombay 12445 343 1
raj banglore 12244 24657 1Now you could understand we have not enough information, especially for urgent request !
Like :
1. business rule
2. oracle version
3. input data sample
Nicolas. -
OCA certification (Senior, expert pls help!!)
Hi all, i am currently a java programmer and is keen to get OCA certify.
May i know what is the difference between 10g n 11g?
Also, y do i need to take 2 exams for 11g but onli 1 exam for 10g???
Lastly, is it possible to SELF STUDY for OCA as i do not have any oracle experience. Only have MS sql experience.
Thank Youhi thanks for your valued info.
But why is there only 1 exam needed for 10g and 2 for 11g?Oracle removed the 'SQL for beginners' exam for the 10g series. That [to me at least] proved to be a mistake as too many people were attempting to get certified without even beginner knowledge of the very language that runs the Oracle database platform. They restored that exam. Now there is verification that the OCA candidate at least can spell SQL, SELECT, UPDATE and so on, and might even be able to use the tools provided.
>
Based on your view, do u think i should start all
over from 9i then slowly upgrade or, take 11g directly?
Pls advise:)I think you should think about your future. Make a decision for yourself based on that. Does you future include Oracle9i DB? Is it important for you to verify that you understand Oracle9i DB?
Many people mistakenly think the purpose of the exam is to get a certificate. I disagree ... I think the purpose of certification is to verify - to yourself and to others - that you are aware of, and potentially understand, the material. (If you use brain dumps, or gunners, or other ways of cheating, you are not verifying that awareness or understanding and will eventually be caught - by your colleagues, your boss, or perhaps by yourself when you look at your reflection in the morning mirror.)
If you do not want to verify your knowledge about 9i, don't bother. -
Expert pls help: Sun IDM with ldap active sync
Hi all,
Currently i am configuring Sun IDM 6.0 SP1 to active sync with Sun directory server. I have enabled Retro Change Log but yet i cant find my changeNumber in directory server. Could anyone show me a way (search?) to get what changeNumber directory server currently running?Check the account used by IDM to access DS can search cn=changelog branch. If he is not Directory Manager, you probably need to set an ACI on that branch.
HTH -
Query needed urgently.Pls help in this regard
1.I need to display the details of employee no,name,image if at all an employee is having a photo attached with his profile and their count.
I need to display the count and the same details for the employees having no photo too.
I did with a query also.But I need some better Query for performance.I used per_images,per_all_people_f(per_people_f) for the above.Could u suggest me any query relating to this.And moreover,can u suggest any settings need to be done in rdf for the same image to display.
2.I need to display the approved time sheets between 3 months period.But I used HXC_Timecard_Summary .But in that table thr is no date duration such as time period column.Its having only start time and stop time which will count only for one day and not for a particular duration.SO,could you suggest me the solution for the same.Sorry, all my crystal balls are on the blink.
You couldn't have guarenteed that you won't get your questions answered any better than you have:
1. Use of the word "Urgent" in your title. To us, your problems aren't any more urgent than anyone else's problems on the forum, and a great deal less urgent than our own problems are!
2. You have provided zero information on your tables, data, etc in terms of what you're working with and what you want it to look like. You expect us to know your table and data structures in depth ... well, see my initial comment re. my crystal balls.
3. You say you've come up with a solution for your first point, but haven't provided it, nor do you appear to have done any searching or anything else that makes me think that you're not expecting us to do your work for you.
I suggest you edit your title to remove the word "urgent" and provide much more detail (table create statements, insert statements, etc) than you have. -
Ordering according comparing - SQL Experts pls help
Hi All,
I want to measure the nearest points according to percentage between these points and order it.
by another way, i want to show the relation between points according to percentage value.
drop table temp_value;
create table temp_value(id number(10),location varchar2(20), percentage number(9));
insert into temp_value values (1,'LOC 1,2',30);
insert into temp_value values (2,'LOC 1,3',0);
insert into temp_value values (3,'LOC 1,4',0);
insert into temp_value values (4,'LOC 1,5',0);
insert into temp_value values (5,'LOC 1,6',50);
insert into temp_value values (6,'LOC 2,3',0);
insert into temp_value values(7,'LOC 2,4',0);
insert into temp_value values (9,'LOC 2,5',0);
insert into temp_value values (10,'LOC 2,6',10);
insert into temp_value values (11,'LOC 3,4',90);
insert into temp_value values (12,'LOC 3,5',80);
insert into temp_value values (13,'LOC 4,5',0);
insert into temp_value values (14,'LOC 4,6',0);
insert into temp_value values (15,'LOC 5,6',0); i want the output like this, the ordering of the point like this
4
3
5
6
1
2 or like this
6
1
2
4
3
5 if you ask me why this ordering i will say that
4 [90 percent between point 3,4 that mean can be 3,4 or 4,3]
3
5 [80 percent between 3,5 that mean can be 5 after 3,4]
6 [50 percent between 1,6 that mean can be 1,6 or 6,1 ]
1
2 [ 30 percent between 1,2 that mean can be 1,2 or 2,1] regards
Edited by: Ayham on Oct 6, 2012 10:18 AM
Edited by: Ayham on Oct 6, 2012 10:43 AM
Edited by: Ayham on Oct 6, 2012 8:04 PMreally i am happy to see you reply but the results is not correct
SQL> select A1.loc as Location, A1.rn as percentage, a2.rw as group_number from
asd a1,
2 (Select rn, row_number() over(order by rn desc) rw
3 from asd
4 group by rn) a2
5 where a1.rn = a2.rn;
LOCATION PERCENTAGE GROUP_NUMBER
4 90 1
3 90 1
5 80 2
3 80 2
6 50 3
1 50 3
2 30 4
1 30 4
6 10 5
2 10 5
6 0 6
LOCATION PERCENTAGE GROUP_NUMBER
6 0 6
5 0 6
5 0 6
5 0 6
5 0 6
4 0 6
4 0 6
4 0 6
4 0 6
3 0 6
3 0 6
LOCATION PERCENTAGE GROUP_NUMBER
2 0 6
2 0 6
2 0 6
1 0 6
1 0 6
1 0 6
28 rows selected.
SQL>it should be like this
LOC Group
3 1
4 1
5 1
1 2
6 2
2 2Edited by: Ayham on Oct 6, 2012 1:11 AM
Edited by: Ayham on Oct 6, 2012 1:11 AM -
hello..i accidenty delete All my files in my ipod touch,,and icant restore my itunes,coz i need a version of itunes 10.6.3,but i only have 32bit..i cant download because they need 64bit,,pls,,help me dont know what to do,,i need to restore my itunes music..sorry im not good in english,,try to understand
I assume you don't have a backup on an external HD. You always should, because then you could easily fix your problem.
Boot in Safe Mode. See What is Safe Boot, Safe Mode? (Mac OS X)
http://docs.info.apple.com/article.html?artnum=107392 Takes a while to run, but it usually "fixes" problems.
Safe Boot takes longer than normal startup
http://support.apple.com/kb/TS1884?viewlocale=en_US
Cheers, Tom -
How to connect my Inspire 5200 5.1 Speakers to my XBOX? Pls Help!!!
Dear all,
I am in need of dire assistance to connect my Creative Inspire 5200 5.1 Speakers to my XBOX. If possible, I would like to maintain the full 5.1 functionality when watching my movies and playing games (that support 5.1 sound).
What other cables, adaptors, connectors do I need? Pls help... I am really not experienced with TV electronics, wires and stuff.Ok, I did a search & found a post by NsOmNiA930 :
>>>
Or, you could make a custom analog adapter and get fake 5.1.You'll need 2 RCA couplers (or a coupler with 4 RCA Female jacks), a dual RCA to single 1/8 mini jack adapter, a single 1/8 female - 2 /8 male adapter, 2 /8 couplers, and a headphone splitter. It should look like this:RCA from Xbox Dual RCA CouplerRCA to 1/8" adapter(1)Female to (2)Male Adapter(2) 1/8" Coupler on Male ends of previous adapterHeadphone splitter on one of the couplersIMPORTANT! BACK MUST BE BY ITSELF ON THE CORRECT /8" END! CENTER AND FRONT SHOULD BE ON THE HEADPHONE ADAPTER! IN ORDER TO FIND THE CORRECT CHANNEL, DO A 5.1 TEST ON YOUR SPEAKERS AND CONFIGURE APPROPRIATELY!
>>>
Ok, can some kind soul translate that into English? What are all these components(adapter, coupler, headphone jack, 1/8?) What do they look like?
Maybe you are looking for
-
Can I share one iPhoto library with all the users in my iMac?
I moved the library to the shared folder and gave it 775 permissions but when I try opening it with the second users it asks if I want to fix permissions. I click OK and after a while it tells me it is locked... which kind of tells me I won't be able
-
What is the noise my iMac does while using boot camp?
Hello. I installed Windows 7 (Ultimate) on my iMac (27, late 2013, 32GB RAM) using Boot Camp and when I start using it, every couple of seconds I hear a noise that only happens with Windows. It's a very soft noise and it keeps repeating. I already se
-
Problems writing metadata in bridge
hi all, we are using mobile users on OD with 10.6.6 and 10.6.7 clients. in bridge CS5 on a mounted afp volume some users can add metadata and rating to pictures, others can't. i tried all thinkable ways: user A, AFP mount as user A = works User B, AF
-
Implementation Of HTML 4.2 Tags in JEditorPane
I am trying to make HTML editor in Java Swings to support all the Tags Of HTML 4.0.1 The problem is that HTML package of Java does not support additional HTML 4.0.1 Tags over HTML 3.2 (which are 24 in Nos.) so we have to render them by coding Java /
-
how can I edit raw data from nikon D600 with CS5