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

Endians forest

here now stands that small knot of villages known as the Endians, a mighty forest once stood. Indeed, legand has it that you could have stoodon the edge of the wood and seen it stretch out for miles, were it not for the trees getting in the way.
In one section of the forest, the trees stood in a row and were of hight from 1 to n, each hight occurring once and once only.
A tree was only visible if there were no higher trees before it in the row.
For example, if the heights were 324165, the only visible trees would have been those of height 3,4 & 6.

Write a Program that takes an array of integers representing the heights of the trees in the row as input and prints the list of the visible trees.
Sep 21 '07 #1
1 1761
Maybe you should read sticky posts.

However I'll try to give you some clue.

Let's suppose heights are positive numbers.
We initialize a maximum variable to zero value.
Then for each height in list :
if it is greater than the maximum, then it is visible, so we set the maximum to that value, and so on...

Now it's up to you...
Sep 21 '07 #2

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

Similar topics

4
by: | last post by:
Assume that we have the following structure to communicate over a serial communication device (Rs232) or ethernet between two or many computers. There is no guaranty that computers have the same...
5
by: Kalle Rutanen | last post by:
Hi Is it endian-safe to use bit operations in C++ ? For example bit-shifts, does the left shift by n always equal multiplicication by 2^n (modulo 2^integerBits), independent of endian system...
2
by: Steven T. Hatton | last post by:
I'm trying to parse an ELF file to build a human readable representation. I know it's been done before, and there are tools such as objdump, nm, readelf, c++filt, etc. I can look at the source to...
1
by: | last post by:
Can anyone help me on how to enumerate all the domains in a forest with VB.NET. Thanks, Dan Rhoads
2
by: Pucca | last post by:
Hi, Can someone show me an example code of how to get a list of all domains existed in a Forest? -- Thanks.
2
by: Pucca | last post by:
Does anyone know where can I download icons for representing Forest and Domain in a Treeview representing a network Forest and domains? -- Thanks.
0
by: kirby.urner | last post by:
Greetings Pythoneers: Per usual, I've been walking this talk in Portland "Open Source Capital" Oregon revolving around Python as a math learning language, viewing math as an extensible type...
1
by: thund3rstruck | last post by:
Hi guys, I've been plugging away at this for a few hours and it's really frustrating me. I have a requirement where I must enumerate domains (and all child domains) in a large forest where I do...
2
by: sathishc58 | last post by:
Hi All I recently studied about "Forest" Datastructures. Supposed we have two trees. Could not represent diagramatically Tree a ====== 1) 10 is the root node 2) 9 is the
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.