Wednesday, May 8, 2013

Key dates and milestones in the S&P 500's history

By Caroline Valetkevitch

NEW YORK (Reuters) - Standard & Poor's, initially known as the Standard Statistics Company, created its first stock market index in 1923. It consisted of the stocks of 233 companies and was computed weekly.

Three years later, it developed a 90-stock composite price index computed daily. That was expanded over the years.

On March 4, 1957, the Standard & Poor's 500 <.inx><.spx> was introduced.

The S&P 500 index has became synonymous with the term "U.S. stock market." It is one of the leading benchmarks for the market, even though others, including the Russell and Wilshire indexes, are broader measures of the market. Still, investors use the S&P 500 as the main index to measure their portfolios' performance, with roughly $5.6 trillion benchmarked to the S&P 500.

The S&P's 500 companies represent the U.S. market more broadly than the Dow Jones industrial average, which includes the stocks of only 30 companies.

American Telephone and Telegraph was the heaviest-weighted stock in the index in 1957. The company, now known as AT&T , is the 11th-largest company in the S&P 500 index.

Today the S&P 500 index has a total market cap of about $14.96 trillion. Sixty-nine of the 500 original companies remain in the S&P 500 today.

Below are some key dates and milestones in the history of the S&P 500.

1923: Standard Statistics Company, as S&P was formerly known, develops its first stock market index consisting of the stocks of 233 U.S. companies, computed weekly.

1926: Standard Statistics creates a 90-stock composite price index, computed daily.

March 4, 1957: The Standard & Poor's 500 index is introduced, tracking the performance of the stocks of 500 leading U.S. companies. With a total market capitalization of $172 billion, the S&P 500 followed the performance of 425 industrial, 15 rail and 60 utility stocks.

1958: S&P 500 ends the year up 38.06 percent, its best year in terms of percentage gain.

June 4, 1968: S&P 500 closes above 100 for the first time.

August 31, 1976: Vanguard introduces the first retail index mutual fund, the Vanguard First Index Investment Trust, which tracks the S&P 500, allowing individual investors for the first time to buy into the broad market with a single purchase. The fund, now known as the Vanguard 500 Index Fund , has $125 billion in assets.

April 21, 1982: The Chicago Mercantile Exchange begins trading futures based on the S&P 500.

July 1, 1983: Options contracts based on the S&P 500 index begin trading on the Chicago Board Options Exchange.

Oct 19, 1987: S&P 500 registers its worst daily percentage loss, falling 20.47 percent. The one-day crash, known as "Black Monday," was blamed on program trading and those using a hedging strategy known as portfolio insurance. Despite the losses, the S&P 500 still ended up that year.

January 22, 1993: State Street's Standard & Poor's Depositary Receipts, or the SPDR S&P 500 , an exchange-traded fund (ETF) that tracks the S&P 500's performance, begins trading on the American Stock Exchange. It was the first ETF to trade in the United States. The first SPDR and the many variations that followed are commonly referred to as the "spiders." The fund currently has about $133.8 billion in assets, making it the largest exchange-traded fund in terms of assets.

September 9, 1997: CME introduces the S&P E-mini futures, which is valued at $50 multiplied by the price of the S&P 500, or one-fifth of the size of the "big" S&P futures contract. It has since become the most heavily traded futures contract on the CME.

February 2, 1998: S&P 500 closes above 1,000 for the first time.

March 24, 2000: The S&P 500 index reaches an all-time intraday high of 1,552.87 during the dot-com bubble.

March 24, 2004: Trading begins in futures on the VIX <.vix>, the CBOE Volatility Index measuring implied volatility of S&P 500 index options. The VIX is known as the market's "fear gauge." It tends to rise when stocks fall. It recently fell to levels not seen since April 2007.

March-September 2005: The index is transitioned from simply market-value weighted to float adjusted, where the market capitalization is calculated using only the number of shares available for public trading.

October 9, 2007: Index closes at a record high of 1,565.15.

October 11, 2007: S&P 500 hits intraday record high of 1,576.09.

Oct 13, 2008: S&P 500 marks its best daily percentage gain, rising 11.58 percent. It also registers its largest single-day point increase of 104.13 points.

2008: For the year, S&P 500 falls 38.49 percent, its worst yearly percentage loss. In September 2008, Lehman Brothers collapsed as the financial crisis spread.

March 9, 2009: S&P 500 closes at 676.53, its closing low after the onset of the 2008 financial crisis and the Lehman Brothers' bankruptcy.

August 20, 2012: Apple becomes the biggest U.S. company and takes over as the market capitalization leader in the S&P 500, pushing Exxon Mobil into the No. 2 spot. Since then, Exxon and Apple have gone back and forth between the two spots, but Apple is currently No. 1 with a market cap of about $409 billion. Exxon's market cap is about $396 billion.

March 28, 2013: S&P 500 ends at 1,569.19, surpassing its previous record closing high set in 2007.

April 10, 2013: S&P 500 hits new all-time intraday record high at 1,589.07, surpassing previous record of 1,576.09 set in October 2007.

April 10, 2013: S&P 500 closes at a record high of 1,587.73 - eclipsing the record reached on March 28, when it climbed above the October 9, 2007, milestone of 1,565.15.

April 29, 2013: S&P 500 ends at a record high of 1,593.61.

April 30, 2013: S&P 500 climbs to an all-time intraday high of 1,597.57 in the final moments of trading - and ends at that level, which also represents another record closing high.

May 2, 2013: S&P ends at a record high of 1,597.59, just off a fresh intraday high of 1,598.60.

May 3, 2013: S&P 500 closes above 1,600 for the first time - finishing at 1,614.42 after a much better-than-expected April U.S. non-farm payrolls report. The index also hit an all-time intraday high of 1,618.46.

May 6, 2013: During the session, the S&P 500 hits an all-time intraday high 1,619.77.

May 6, 2013: S&P 500 ends at a record high of 1,617.50.

Sources: S&P Dow Jones Indices Senior Index Analyst Howard Silverblatt, the Standard & Poor's book, "Innovation & Evolution, The S&P 500," CME, CBOE, Vanguard Group Inc, State Street Global Advisors, Thomson Reuters.

(Reporting by Caroline Valetkevitch; Editing by Jan Paschal and Nick Zieminski)

Source: http://news.yahoo.com/key-dates-milestones-p-500s-history-213242943.html

mark zuckerberg mark zuckerberg

Tuesday, May 7, 2013

Nokia Confirms the Existence of Its New Lumia 928

Rumors have swirled for weeks about Nokia's hotly anticipated new phone, the Lumia 928. Now Elop and co have finally released an official image to tease us.

While it doesn't give too much away, it does at least confirm the naming, and the image does bear some similarity to previous leaks. It certainly appears to sport the aluminum case that has been rumored?a departure from the funky primary colors that currently define the Lumia range.

A corresponding magazine advert announcing the handset's imminent arrival on Verizon also highlights the phone's photographic talent. In particular, it mentions PureView, optical image stabilization, and a Carl Zeiss lens.

There's currently no hint of further specs, pricing or launch date, with Nokia simply telling us to "stay tuned for updates." [Nokia via Engadget]

Source: http://gizmodo.com/nokia-confirms-the-existence-of-its-new-lumia-928-493312533

Canoodle Isaac path Tropical Storm Isaac path Hurricane Katrina Hurricane Isaac Path Isaac Hurricane earthquake san diego

Tuesday, April 23, 2013

David Ortiz forgiven by FCC for expletive Boston will never forget (+video)

David Ortiz used an expletive in his defiant (and televised) speech Saturday before the first Red Sox home game since the Boston Marathon bombing. The FCC has already weighed in. ?

By Mark Sappenfield,?Staff writer / April 21, 2013

Boston Red Sox slugger David Ortiz pumps his fist in front of an American flag and a line of Boston Marathon volunteers after addressing the crowd before a baseball game between the Red Sox and the Kansas City Royals in Boston Saturday.

Michael Dwyer/AP

Enlarge

On a day when the city of Boston came to Fenway Park for its collective exhale, honoring the governor and mayor and law enforcement officials who have served with such distinction during the past week of terror, it was the one indelible moment. The crowd roared louder than it had all afternoon. People on the Internet are already making T-shirts.

Skip to next paragraph Mark Sappenfield

Staff writer

Mark is deputy national news editor for the Monitor.

Recent posts

' + google_ads[0].line2 + '
' + google_ads[0].line3 + '

'; } else if (google_ads.length > 1) { ad_unit += ''; } } document.getElementById("ad_unit").innerHTML += ad_unit; google_adnum += google_ads.length; return; } var google_adnum = 0; google_ad_client = "pub-6743622525202572"; google_ad_output = 'js'; google_max_num_ads = '1'; google_feedback = "on"; google_ad_type = "text"; google_adtest = "on"; google_image_size = '230x105'; google_skip = '0'; // -->

It was, in five words, the encapsulation of a city's defiance ? bowed, but never broken. Not even close.

It also happened to be NSFW (not safe for work). Or children. Or anyone in Mr. Rogers' neighborhood.?

It was the declaration by legendary Red Sox slugger David Ortiz in pregame ceremonies Saturday, which were broadcast nationwide.

"This is our f------ city, and nobody's going to dictate our freedom."

In recent years, the Federal Communications Commission has taken to calling such incidents "fleeting expletives," and has grown increasingly grumpy about them. For years, the major television networks behaved themselves, pushing any potentially objectionable content past 10 p.m., when kids who might ask "Mommy, what is cow s---?" had already gone to bed.

Then came reality TV star Nicole Richie, who said live during the December 2003 Billboard awards show on Fox, "Have you ever tried to get cow s--- out of a Prada purse? It's not so f------ simple."

Or U2 singer Bono, who said during NBC's broadcast of the Golden Globes awards show earlier that year: "f------ brilliant."

For these incidents and others, the FCC responded by fining networks more than $1 million. Though the fines were later overturned by the Supreme Court, the point was made. There was a new sheriff in town. The networks have responded, running awards shows on several-second delays so they can beep out any offenders.

But on Saturday, no one beeped out Mr. Ortiz ? known to Bostonians as "Big Papi." And within the hour, FCC chairman Julius Genachowski had taken to Twitter to say that was just fine.

"David Ortiz spoke from the heart at today's Red Sox game. I stand with Big Papi and the people of Boston - Julius," the tweet read.

Mark Townsend of Yahoo's Big League Stew blog added his 2 cents: "There's a right time, and there's a wrong time to be too emotional. Today was definitely the right time (and yes, I know there were children in the building)."

Commenters largely agreed. One, named Hawk, summed up the sentiment this way: "I'm gonna go ahead and vote Papi for MVP. Most Valuable Phrasing!" Another, named Ted, added: "When Papi said that, I got goosebumps."

On a joyous day to end a tragic week that Boston ? and the world ? will not soon forget, Ortiz's expletive was anything but fleeting, it seems.

Source: http://rss.csmonitor.com/~r/feeds/csm/~3/GMMhaV6s3rE/David-Ortiz-forgiven-by-FCC-for-expletive-Boston-will-never-forget-video

caucus results exton kurt warner kurt warner ricky williams missouri primary minnesota caucus

Monday, April 22, 2013

The Evolet Process puts focus on healthy relationships - News ...

Sorry, Readability was unable to parse this page for content.

Source: http://jamaica-gleaner.com/gleaner/20130420/news/news6.html

irs forms kevin hart oklahoma city bombing Audrie Pott Bombing In Boston Rebel Wilson Patriots Day

Bank of England's cheap credit scheme to be extended - reports

LONDON (Reuters) - A scheme to get more credit flowing in Britain's stagnant economy will be expanded to include specialist lenders and will run for a year longer than planned, the Sunday Telegraph newspaper reported.

The Bank and the Treasury have been working on plans to extend the 80-billion-pound Funding for Lending (FLS) scheme, and the newspaper said an announcement could come as early as this week.

Chancellor George Osborne is under pressure to do more to foster growth after Britain lost its AAA credit rating - the top grade - from two agencies and the International Monetary Fund said the government should consider slowing the pace of its deficit-cutting programme.

The Financial Times reported on Sunday that Treasury officials hoped the introduction of a second stage of the FLS scheme might give the IMF reason not to criticize economic policy when it carries out an annual review next month.

Osborne said on Friday the government and the central bank would announce "fairly shortly" changes to the scheme, which provides banks and other lenders with cheap financing if they keep or raise lending to households and businesses.

The FLS was launched last year but so far it has not resulted in much more borrowing by small and medium-sized companies.

The Telegraph said the FLS, originally due to end in January next year, would be extended by a year to 2015.

The newspaper said the scope of the scheme would be expanded to include specialist institutions such as asset-based lenders, invoice finance houses and leasing firms in an attempt to ease the credit crunch still felt by small firms.

A Treasury spokesman declined to comment on plans to change the FLS beyond what Osborne had said on Friday.

Asset finance allows businesses to borrow against invoices and machinery.

Since coming to power in May 2010, the Conservative-Liberal Democrat coalition has introduced austerity measures to try and reduce a record peacetime deficit, but persistently weak growth has frustrated the government's economic plans.

(Reporting By Estelle Shirbon and William Schomberg; Editing by Erica Billingham)

Source: http://news.yahoo.com/bank-englands-cheap-credit-scheme-extended-reports-022802315--sector.html

seattle mariners geraldo rivera supreme court health care joe oliver joba chamberlain new york mega millions jetblue

Sunday, April 21, 2013

AP PHOTOS: Scenes from the past two days in Boston

AAA??Apr. 20, 2013?9:32 PM ET
AP PHOTOS: Scenes from the past two days in Boston
By The Associated PressBy The Associated Press, Associated Press?THE ASSOCIATED PRESS STATEMENT OF NEWS VALUES AND PRINCIPLES?

In this Friday, April 19, 2013 photo obtained by The Associated Press and authenticated by a member of the Bureau of Alcohol, Tobacco, Firearms and Explosives, ATF and FBI agents check suspect Dzhokhar Tsarnaev for explosives and also give him medical attention after he was apprehended in Watertown, Mass., at the end of a tense day that began with his older brother, Tamerlan, dying in a getaway attempt. Tsarnaev lay hospitalized in serious condition under heavy guard Saturday as investigators continue piecing together the who and why of the two brothers involved in the deadly Boston Marathon bombings. (AP Photo)

In this Friday, April 19, 2013 photo obtained by The Associated Press and authenticated by a member of the Bureau of Alcohol, Tobacco, Firearms and Explosives, ATF and FBI agents check suspect Dzhokhar Tsarnaev for explosives and also give him medical attention after he was apprehended in Watertown, Mass., at the end of a tense day that began with his older brother, Tamerlan, dying in a getaway attempt. Tsarnaev lay hospitalized in serious condition under heavy guard Saturday as investigators continue piecing together the who and why of the two brothers involved in the deadly Boston Marathon bombings. (AP Photo)

This Friday, April 19, 2013 image made available by the Massachusetts State Police shows 19-year-old Boston Marathon bombing suspect, Dzhokhar Tsarnaev, hiding inside a boat during a search for him in Watertown, Mass. He was pulled, wounded and bloody, from the boat parked in the backyard of a home in the Greater Boston area. (AP Photo/Massachusetts State Police)

Neil Diamond sings '"Sweet Caroline" during the eighth inning of a baseball game between the Boston Red Sox and the Kansas City Royals in Boston, Saturday, April 20, 2013. (AP Photo/Michael Dwyer)

Joy Arcolano, who's home is near the location where the previous night a suspect in the Boston Marathon bombings was arrested, hugs a neighbor as members of the media, look on, Saturday, April 20, 2013, in Watertown, Mass. Police captured Dzhokhar Tsarnaev, 19, the surviving Boston Marathon bombing suspect, in a backyard boat after a wild car chase and gun battle earlier in the day left his older brother dead. (AP Photo/Matt Rourke)

This Friday, April 19, 2013 image made available by the Massachusetts State Police shows a police vehicle probing the boat where 19-year-old Boston Marathon bombing suspect, Dzhokhar Tsarnaev, was hiding in Watertown, Mass. He was pulled, wounded and bloody, from the boat parked in the backyard of a home in the Greater Boston area. (AP Photo/Massachusetts State Police)

For a time, it seemed like the dragnet that had shut down a metropolitan area of millions while legions of police went house to house looking for the suspected Boston Marathon bomber had failed. But then there were cheers of jubilation as the suspect, who had been holed up in a boat in Watertown, was driven away by police, captured at last. The manhunt was over.

Here's a gallery of photos looking back over the past two days in the search for the Boston Marathon bombers, and the aftermath.

Associated Press

Source: http://hosted2.ap.org/APDEFAULT/3d281c11a96b4ad082fe88aa0db04305/Article_2013-04-20-AP-AP-Boston-Marathon-Photo-Gallery/id-1838cf124b274c339196b47caffd5e62

redbox Nemo Storm weather forecast national weather service weather channel Rivals Kaepernick

Thursday, April 18, 2013

Count Frequency Of Strings In Java Binary Tree ... - Dream In Code


Example
#{example}
"); ipb.editor_values.get('templates')['togglesource'] = new Template("
??? Cancel Source Edit
"); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
  • Icon
  • "); ipb.editor_values.get('templates')['menu_item'] = new Template("
  • #{title}
  • "); ipb.editor_values.get('templates')['togglesource'] = new Template("
    ??? Cancel Source Edit
    "); ipb.editor_values.get('templates')['emoticons_showall'] = new Template(""); ipb.editor_values.get('templates')['emoticon_wrapper'] = new Template("

    Emoticons

    "); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]\n \n Test\n \n[/xml]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"member":{"id":"31","title":"Member","desc":"Given a member name, a link is automatically generated to the member's profile","tag":"member","useoption":"1","example":"[member=skyhawk133] runs this site.","switch_option":"0","menu_option_text":"Input Username of Member","menu_content_text":"","single_tag":"1","optional_option":"0","image":"memberbbcode.png"},"extract":{"id":"33","title":"Extract Blog Entry","desc":"This will allow users to define an extract for an entry. Only this piece of the entry will be displayed on the main blog page and will show up in the RSS feed.","tag":"extract","useoption":"0","example":"[extract]This is an example![/extract]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"blog":{"id":"34","title":"Blog Link","desc":"This tag provides an easy way to link to a blog.","tag":"blog","useoption":"1","example":"[blog=100]Click me![/blog]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"entry":{"id":"35","title":"Blog Entry Link","desc":"This tag provides an easy way to link to a blog entry.","tag":"entry","useoption":"1","example":"[entry=100]Click me![/entry]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"twitter":{"id":"36","title":"Twitter","desc":"A tag to link to a user's twitter account","tag":"twitter","useoption":"0","example":"[twitter]userName[/twitter]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":"twitter.png"},"inline":{"id":"37","title":"Inline Code","desc":"Formats code inline instead of in a seperate code box. ","tag":"inline","useoption":"0","example":"[inline]style=\"font-size: 12px;\"[/inline]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"il":{"id":"38","title":"Abbreviated Inline (IL)","desc":"Abbreviated version of the [inline] tag. ","tag":"il","useoption":"0","example":"[il]Code Here[/il]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":"il2.png"},"code":{"id":"41","title":"Code","desc":"Allows you to enter general code","tag":"code","useoption":"1","example":"[code]$text = 'Some long code here';[/code]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"1","image":""}}) ); ipb.vars['emoticon_url'] = "http://cdn.dreamincode.net/forums/public/style_emoticons/default"; //Search Setup ipb.vars['search_type'] = 'forum'; ipb.vars['search_type_id'] = 32; ipb.vars['search_type_2'] = 'topic'; ipb.vars['search_type_id_2'] = 318700; //]]>

    3 Replies - 23 Views - Last Post: 18 minutes ago Rate Topic: -----

    #1 ccb77 ?Icon User is online

    Reputation: 0

    • Posts: 13
    • Joined: 24-March 13

    Posted Today, 12:14 PM

    How do I implement a frequency counter in a treenode that increases when the user enters an existing word?

    I have a program where the user is asked to choose: enter string, search for string

    My frequency counter is not working properly. How do I keep track of the frequencies for the left and right nodes? My frequency counter only gives for root:

    
 public void insert(String item){  		if(isEmpty()){		 			root = new TreeNode(item);                          System.out.println("inserted " + "'" + item + "'" + " into tree. Frequency: " + root.getFreq());                 }                // If string item already exists, do not insert another node, increase the frequency of the node containing the string                         else if(searchTree(root,item) == true){                             root.upFreq();                                                          System.out.println( "'" + item + "'" + " already exists! Frequency: " + root.getFreq());                  //if the string does not already exists, enters string item into new node                                } else{                                                root.add(item);                      System.out.println("inserted " + "'" + item + "'" + " into tree! Frequency: " + root.getFreq());                              }                            }   
    
  static boolean searchTree(TreeNode root, String item){             if(root == null){                 return false;             }             if(root.item.equals(item)){                 //root.upFreq();                                  return true;                         }             return searchTree(root.left, item) || searchTree(root.right, item);             } 


    Is This A Good Question/Topic? 0

    Replies To: count frequency of strings in java binary tree

    #2 baavgai ?Icon User is online

    Reputation: 4823

    • Posts: 11,185
    • Joined: 16-October 07

    Re: count frequency of strings in java binary tree

    Posted 47 minutes ago

    Dude! How in the hell can your searchTree be static?!? Tell me TreeNode isn't public...

    Your searchTree is, um, disturbing. You should be going left or right, not returning left || right. You call it and seem to expect that root has meaning. It doesn't.

    Implement a find item. Go from there:

    
 private TreeNode findNode(TreeNode parent, String item) { /* your code here */ }  private TreeNode insert(TreeNode parent, String item) { /* your code here */ }  private boolean searchTree(String item) { return findNode(this.root, item)!=null; }  public void insert(String item){ 	if(isEmpty()){ 		this.root = new TreeNode(item);  		System.out.println("inserted " + "'" + item + "'" + " into tree. Frequency: " + root.getFreq()); 	} else { 		TreeNode node = findNode(this.root, item); 		if(node!=null) { 			node.upFreq(); 			System.out.print( "'" + item + "'" + " already exists!"); 		} else { 			node = insert(this.root, item); 			System.out.print("inserted " + "'" + item + "'" + " into tree!"); 		}   		System.out.println(" Frequency: " + node.getFreq()); 	} } 

    Hope this helps.


    #3 ccb77 ?Icon User is online

    Reputation: 0

    • Posts: 13
    • Joined: 24-March 13

    Re: count frequency of strings in java binary tree

    Posted 29 minutes ago

    Thanks, no the treenode was not public, and the static was a typo.....


    #4 ccb77 ?Icon User is online

    Reputation: 0

    • Posts: 13
    • Joined: 24-March 13

    Re: count frequency of strings in java binary tree

    Posted 18 minutes ago


    Page 1 of 1


    Source: http://www.dreamincode.net/forums/topic/318700-count-frequency-of-strings-in-java-binary-tree/

    same day flower delivery valentines day cards hallmark grammy winners obama budget woolly mammoth belize resorts