2 2475
Bart's article should be able to give you some valuable pointers.
I have changed my code a little.. I managed to do a little dfs.. but i am unable to get the value of the top item on the stack...
Graph.java
Stack.java - public class Stack extends List {
-
// int i=0;
-
public Stack() {
-
super();
-
}
-
-
public boolean push(Object newItem) {
-
// if(super.size()==0)
-
return insert(1, newItem);
-
//else
-
// return insert(super.size()+1,newItem);
-
-
}
-
-
public Object pop() {
-
return remove(1);
-
}
-
-
public Object peek()
-
{
-
//am i right here?
-
return super.getItem(super.size());
-
}
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Raed Sawalha |
last post by:
I have following XML:
How can I find the depth of XML?
in other word max level of the XML
<Root> ----- level 0
<Name>----- level 1
<FirstName>name</FirstName> ---- level 2
<LasName>lname</LastName>
<MiddleName>mName<MiddleName>
</Name>
|
by: Jani Yusef |
last post by:
I want to create a tree of processes. The depth of the tree is given
by the variable depth and the number of processes started by each node
is given by the variable numberOfProcesses.
Is the following code correct? I don't think it is, especially since I
don't want the bottom nodes(leaf nodes) to start any processes
themselves.
Any comments on the following code would be much appreciated!!
for(j=0;j<depth;j++){...
|
by: Michael Ramey |
last post by:
Hi,
Is there any easy way to get the number of nested folders for a given path.
for instance I have the following
(trying my best to simulate a view you would see in windows explorer)
c:\temp
\folder1a
\folder1b
\folder2a
|
by: David |
last post by:
I have a problem that just cropped up with using an ImageList in my project
I am using VB .NET 200
Problem:
I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and ImageList24 (for 24x24). I have inserted images in each and it has worked fine for months... The System.Drawing.Bitmap properties for these images are PixelFormat=32bppArgb and RawFormat=MemoryBmp with the Horiz and VerticalResolution = 96
I...
|
by: darrel |
last post by:
I've decided that instead of doing an XSLT transformation on a file, I might
be better off bringing it in as a dataset and having a bit more direct
control over it at that point.
The question I have is if one can determine the node depth as they import
the XML. I could, obviously, just put the node depth in as another xml
element at the time of creation, which really isn't a big deal, but thought
I'd see if I could do it on the import...
| |
by: datamodel |
last post by:
Hello I have an XML tree of which you can see a mini-version here:
http://paste.uni.cc/11838
(the tree is actually over 30,000 levels deep)
How do I count the depth of a given <NODES><NODE?????
The problem is I would like to "color" nodes based on their depth in
the tree - ie, use alternating colors.
|
by: Daz01 |
last post by:
Hi, Ive written a program. But I want to add a class in it somehow? Is
there any easy way to do it.
Below is the code for the program:
#include <cstdlib>
#include <iostream>
using namespace std;
|
by: softwaredoug |
last post by:
I can't see to easily find this on google or in a newsgroup
Is there a standard function/macro/whatever you can call and determine
the distance in a C program how deep one is in the C call stack from
main.
Something along the lines:
int main()
{
|
by: =?Utf-8?B?SmF5IFZpbnRvbg==?= |
last post by:
I see general messages about how to learn .NET but I have an immediate
requirement to ramp up my old skills very quickly.
Can anyone recommend the FASTEST way for me to get almost-competent in
VB.NET (C# will come later)? This must be an online or book adventure because
I can't totally disappear to attend physical classes.
I have 15 years experience with commercial VB & C development, and I
understand OO & database. I'm looking for a...
|
by: pereges |
last post by:
Hello I need some ideas for designing a recursive function for my ray
tracing program.
The idea behind ray tracing is to follow the electromagnetic rays from
the source, as they hit the object.The object is triangulated. The
rays can undergo multiple reflections, diffractions etc of the same
object i.e. a ray hits a surface of the object, undergoes reflection
resulting in a reflected ray which can again hit a surface, corner or
edge...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |