473,378 Members | 1,621 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,378 software developers and data experts.

a stl list of list with jump back

Hi, i need to create a list of list in STL where each element can move
from a given list level to the adjacent list.

i.e.

| -> x -> y -> z

| -> a -> b

can be modified to

| -> x -> y

| -> z -> a -> b

the idea is that element can jump back the head of each list and then
acces the other adjacent list (below). Space is not an issue: I accept
the cost of the back pointer. But operation should be done in O(1).

What is the best way to describe this in STL?
Jul 23 '05 #1
3 1692
Hello Antonio,
Hi, i need to create a list of list in STL where each element can move
from a given list level to the adjacent list.

i.e.

| -> x -> y -> z

| -> a -> b

can be modified to

| -> x -> y

| -> z -> a -> b

the idea is that element can jump back the head of each list and then
acces the other adjacent list (below). Space is not an issue: I accept
the cost of the back pointer. But operation should be done in O(1).

What is the best way to describe this in STL?


I dont even understand what you are trying to do here. Can you provide a
better example?

thanks
bharat kari
Jul 23 '05 #2
> the idea is that element can jump back the head of each list and then
acces the other adjacent list (below). Space is not an issue: I accept
the cost of the back pointer. But operation should be done in O(1).

What is the best way to describe this in STL?


Just use one or more list of elements.
NOT lists of lists.

You will find that list has a member function call splice() (and there are
several versions of it), which allows you to splice elements from one list
into another or even whole lists and specify where it insert element(s).
I think with 2+ list objects you will find that splice() allows you to
transfer elements

Stephen Howe
Jul 23 '05 #3
agu
Antonio Gulli wrote:
Hi, i need to create a list of list in STL where each element can move
from a given list level to the adjacent list.

i.e.

| -> x -> y -> z

| -> a -> b

can be modified to

| -> x -> y

| -> z -> a -> b

the idea is that element can jump back the head of each list and then
acces the other adjacent list (below). Space is not an issue: I accept
the cost of the back pointer. But operation should be done in O(1).

What is the best way to describe this in STL?


The idea is to implement in efficient way
http://magna.cs.ucla.edu/~hxwang/stream/karp-tods03.pdf
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Moosebumps | last post by:
Does anyone here find the list comprehension syntax awkward? I like it because it is an expression rather than a series of statements, but it is a little harder to maintain it seems. e.g. you...
41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
9
by: kazio | last post by:
Hello, So, I need to have double linked, circular list (last element point to the first one and first one points to the last one). I thought maybe I could use list container from STL, but...
4
by: Sleepless on the Web | last post by:
Is there a limit to how many items can be in a jump list? My script worked fine with 126 items, but at 152 items it just doesn't work. When I select a page from the drop down menu it will only...
2
by: VB Programmer | last post by:
I created a page which I am using to prevent the user from hitting the BACK button. I'll call it my "Auto Jump" page. When it is called it basically auto-redirects to a page specified in the...
11
by: Madison Kelly | last post by:
Hi all, I am new to the list and I didn't want to seem rude at all so I wanted to ask if this was okay first. I have a program I have written in perl which uses a postgresSQL database as the...
4
by: robert d via AccessMonster.com | last post by:
When my app starts up, it creates a temporary database. This temp database is created from a 'model' database that is in the same folder as the application. Because there is a model, the creation...
6
by: Heiko Wundram | last post by:
Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Comments appreciated, including on the sample implementation. ===...
1
by: Zhang Weiwu | last post by:
I know the subject line is really bad. Here is the real question: we have a web application that lists 1200 products. The web page present only 12 products at once, if you wish to see the next 12...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.