Jul 26, 2008

Data Structures -- String -- Arrange Based On Repetition - String data structure

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Others

free web hosting

Data Structures -- String -- Arrange Based On Repetition - String data structure

varalu
Consider a string with any number of elements occurring any number of time.

Rearrange the string in such a way that the alphabet with most occurrence occurs in the followed by the next most occurring alphabet and so on... It should also be seen that the alphabets should occur frequency number of times.

Example:

Input : abcdaeghzabcdbhb
Output : bbbbaaaccddhhegz

Reply

fffanatics
First of all, why are you posting a problem and not a solution or tutorial on how to find the solution? Your current post is just stupid since it is hard to respond to and it just looks like you are trying to get credits in any possible way.

However, to solve this (since you did not say) is really easy. You can do it in O(n) and there are multiple ways to achieve this. The easiest method is O(n^2) or O(nlogn) depending on the sort method used. Since you know the size of the alphabet so you can initilize counts to zero. Then go through the string incrementing the letter's value by 1. Then just sort the list and print out the corresponding letter's and their counts.

To do this in O(n), you would have to be kinda of tricky with how you store and sort. What you would do is obtain a letter's value and concatenate that number of them to the correct part of the out string (which you would keep track of with another string of values or an array).

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : data, structures, string, arrange, based, repetition, string, data, structure

  1. Need Help With My Database [resolved]
    retrive data as a link (6)
  2. Warlords Series And Other Turn Based Strategy Games
    Both RTS (Battlecry) and TBS (0)
    So are there any fans of any of the above mentioned games? Personally Warlords series is one of my
    favorite game series and definitely has the best music. Other great games I have enjoyed very much
    are Disciples, Age of Wonders and Lords of Magic. How about you?....
  3. Very Disappointed With Data Center Migration
    What do you think? (9)
    I am hopping mad. I have had nothing but grief since Trap 17 moved their Data Center (DC).
    My site has been down more time than it has been up. I have had to contact Live Support at Xisto 4
    times now in the last month. This is ridiculous. They fix things, it lasts a few days and my site
    is down again. I am at my wits end. I have been told my support to contact Shree. I have
    already communicated with him and he told me that things were solved 6/16, then whatever happened,
    my site was lost completely and had to be restored from their backup. My whole acc....
  4. Free Newsgroups (based On Nntp Protocol)
    Discussion on benefitting from free newsgroups (0)
    If you are reading this you know what a discussion forum is. It is also called as newsgroup or
    usenet groups. This was the first application of computer networks- computer programmers and
    scientists used to collaborate over usenet groups! So what is the difference between
    traditional usenet groups and a discussion forum like this? Here is a short answer: Usenet groups
    are hosted on dedicated servers using NNTP protocol. The users need to have a client like Mozilla
    Thunderbird or Opera mail client to subscribe to usenet groups. Typically, you don't use a b....
  5. 1 Terabyte Of Data On A Thumb Drive
    Yes, a whole terabyte! (8)
    Source Seriously, this is innovative. I can't wait for them to produce these...though you know
    the sellers are gonna jack the hell out of the price. In any case, I can only wonder what this will
    mean for desk top and laptop computers. I mean if they can fit a terabyte in a thumb drive with this
    technology, think of how much they can fit into a normal comp. Think of how much music that would
    hold....how many games you could fit.....the possibilities are almost literally endless.....
  6. Text Based Rpg Game Maker
    (3)
    Well I need one, if you can help please do...I would like it so I can have people play online.....
  7. Sending E-mails Based On Intervals?
    (7)
    Again, I need your help. I have two database entries, let's say "reg_users" and "news". The
    question is that if somethings was changed in the "news" database, the email letter will be sent
    automatically to all emails which are related to "reg-users" database. So, how can I accomplish this
    point. How can I set this process based on daily, weekly or monthly basis?....
  8. Unexpected T_string In User.php [resolved]
    (5)
    Ok so i'm working on a site for my chruch, and i seem to be having a little bit of trouble with
    the user.php file i keep getting the following error: CODE Parse error: syntax error,
    unexpected T_STRING in /home/darkzone/public_html/test/user.php on line 195 and i was wondering
    if some one could help me with the script. session_start(); ob_start(); //Include the
    configurations include('config.php'); //Define a few variables $x = $_GET ;
    $u = $_GET ; class register { function displayform($title) { echo('....
  9. Eraser - Erase Your Data Permanently! For Free
    A must have software (7)
    When you delete file and empty recycle bin (Windows), it doesn't actually gone permanently!
    Many software can be used to recover those deleted files. Now think and imagine, you've deleted
    your personal file or something then someone recover and steal it. Don't worry, Eraser will come
    in handy What does it do? It delete files permanently! Nothing and noone can recover it. You
    can make previously deleted files not recoverable too by using Erase unused disk space feature. (if
    you want to sell your harddisk, use this) How can? It uses the patterns used ....
  10. Text Based Game
    (5)
    Is it possible to make a Text Based game with only HTML and some PHP for chat? I dunno any
    languages besides HTML. =.= yeah Im a newbie.....
  11. Budding Java Game Developers?
    Ever wanted to make your own java web-based game, but not had the time (8)
    Right, this is the first post of hopefully many in this thread. Basically the idea is to get many
    developers together to share ideas and knowledge to create our very own game. First we'll be
    asking for is any ideas of what kind of game everybody would like to make, and then we'll set
    about assigning tasks depending on everybodies skills. We will need programmers, artists,
    web-designers, even admin and marketing. This will be freeware, but the experience will be great.
    So, ideas anyone?....
  12. Make A Flat Based Shoutbox, With Auto Refresh.
    (6)
    With this tutorial, you will learn how to create a simple shoutbox, but only uses a .txt file. Also
    with auto refresh, and I am going to do a backgound. We will be making 5 files. 1. index.php The
    main page 2. msg.php Reading msg.txt 3. msg.txt Note: You must give it 777 4. shout.php Where
    it add to msg.txt 5. bg.gif Background. Index.php would be like this: Shoutbox
    Name: Message: Let's go over what the code do. -> are just the title.
    gets msg.php which gets msg.txt. You will know why I do that later. -> is wh....
  13. What Is The Best Software
    what is the best software to recovery the data (5)
    Hi any one can tell me what is the best software to recovery the data ....
  14. Remove A Value From A Php Array Based On Its Value
    (5)
    I have an index array CODE $array[0] = 10; $array[1] = 12; ...
    Its kinda late and I'm falling asleep now but I had a quick look through PHP.net, and could not
    find what I'm after, Maybe I'm too sleepy, sorry, but if anyone knows off the top of their
    head a way to removed members in that array based on its value, i.e. I wanna remove values 12. I
    don't really want to do a loop but if I cant find any existing function to do it, then I may
    have to. Thanks for any help.....
  15. Ghostbusters - The Video Game
    New movie-based game coming Fall 2008 (5)
    Next fall, who you gonna call? Ghostbusters – The Video Game, based on the 1984 worldwide
    blockbuster hit created by Dan Aykroyd and Harold Ramis which spawned a 1989 sequel, a popular
    Saturday Morning animated series and countless spin-offs, will hit stores next fall for the
    next-generation gaming consoles. Sierra, the software developer behind the RTS hit World in Conflict
    and the SWAT series, will co-produce the games with Sony Pictures Entertainment. GameTrailers.com
    has posted a debut trailer available in HD and standard definition formats. It’s a little short wit....
  16. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
        background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
    folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
    create an index.php file and copy/paste the following script. CODE <?php $hour =
    date('H'); if ($hour < 12 ) {     $image =
    "morning.png"; } ....
  17. Three Neat Avatar-based Sites
    Zantarni, Menewsha and Elyzeria (7)
    I'm not sure if this goes here. Sorry if it's the wrong place. lol /tongue.gif"
    style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> I joined three neat sites
    this week: Zantarni, Menewsha and Elyzeria. Elyzeria This is a cool site. It's not
    avatar-based, actually. You make three characters on your account and they can have a certain class
    (mage, healer, or warrior). And they can be either a human, elf or dwarf. You have to feed them and
    basically improve their stats. You can go on quests. There's a whole lot more to it. I'll ....
  18. Carpentry Information
    Based on my experiences as a Carpenter (9)
    This is my "Day Job". If anyone has any questions about Carpentry, Cabinetmaking, Finish
    Carpentry, Timber Framing or Woodworking (in general), I would be pleased to assist them with find
    answers. I am not "ticketed", which means I haven't learned any bad habits from schools, but
    with more than a few years in Construction, and having worked from Concrete to Countertops, I am
    very experienced. And that is a fair to middling Teacher... /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Residential, Commercial,
    Industrial, Interior....
  19. How Good Is This Data Cleaning Function?
    (2)
    Hi all, this is my first function and as part of a script and i just want to know a couple of
    things. here is the code for the function: CODE <? function
    clean($dirty_string) { $muddy_string = stripslashes($dirty_string);
    $murky_string = strip_tags($muddy_string); $clean_string =
    htmlentities($murky_string);      }; ?> So the first thing is how secure is
    it? the script this will be used in connects to a database and sends an email so it needs to stop
    SQL injections and any email ab....
  20. Data Can Be Stored On Paper
    Store GB's of electronic data on Paper (31)
    A student has developed a technique to store data on portable paper :-) ....
  21. Get 30 Gb Email For Free
    let us talk about , email system for huge data ! (30)
    Friends here we are talking about largest email, free System http://www.30gigs.com this one is
    good and can handel many file at a time. plz let me know any one having this type of information
    ! Also for small user www.walla.com is good one....
  22. Travian Browser Based Game
    The Travian Story (1)
    This is the story of travian which is a game found at http://www.travian.com it is a game based on
    real time except it is set in the middle ages it is all about runnign you own litte village and
    expanding your kingdom by conquering new villages or settleing in emty vallys but i dnt want to be
    talking about that as you will find all the info you need in the site i am here to show everyone the
    translated story of travian which is a little project of mine. you see travian started in germany
    and now has servers for england, america, france, spain, germany, holland and ital....
  23. New Tech: Data Transmiting At 2.56 Terabites Per Second!
    Thats like 60 dvd's per second! (11)
    QUOTE Japanese and German researchers have transmitted data over a 160 kilometer link. This
    breaks the old record witch was held at 1.28 terabits per second. This new technology has
    allowed the researches to transfer 2,560,000,000,000 bits per second witch is the equivalent to 60
    dvd's.And this is PER SECOND ...... Just amazing what these people can come up with,
    stuck in a labatatory with copper wire everywhere,... wait more like fiber-optic. -To me this
    shows the progression of technology and speed of witch we will shortly be able to achei....
  24. C Problem: "two Or More Data Types In Declaration"
    also need help with malloc (5)
    What does it mean when I get the error QUOTE two or more data types in declaration of (function
    name) It's almost the exact same as a function I have in another program that compiles and
    works fine. Also, can someone explain malloc or give me a tutorial? Like where and how you use it,
    and if there are any restrictions to where you can use it. Shortened topic title to fix page
    distortion on the home page. Edit: Made new title make sense >_> ....
  25. Do You Use (or Plan To) Asp.net?
    Or some other .NET based evniroment? (7)
    I'm interested how many of you use .NET framework, how do you like it, what are it's pros
    and cons, and anything that comes accross your mind related to it? I'm using PHP/MySQL
    combination for now, but I'm considering move to ASP.NET. I've never even used ASP, so what
    do you recommend? ASP.NET or NOT ASP.NET? Or maybe to start with ASP?....
  26. My Ipod Is Randomly Skipping Songs, Losing Data,
    regaining data, and freezing (21)
    This morning I was going to listen to some music, so I got my iPod, turned it on, and it reset (I
    hadn't had it plugged in for a while). When I got to the music, it would go through half of a
    song, then skip to the next. After doing this a couple times, it would just skip entire songs.
    It'd skip six or seven, then do half of one, then skip six or seven more. Later I looked on the
    internet for some ideas, so eventually I tried resetting it again, as instructed. This worked for a
    little bit, but then it started skipping over songs again. I reset again, and it lost....
  27. Opengl And Mfc Dialog Based Application
    some comments about using it together (7)
    AS you probably know you can create a simple OpenGL applications using WinAPI functionality only
    (you can create it using Microsoft Visual Studio), but if you are making somethink with real windows
    interface and want to create application with multiple windows/dialogs/buttons with Windows Styles
    etc... you can use MFC (Microsoft Foundation Classes) to do it ... But i did a 2 hours web search to
    find example of using OpenGL windows inside MFC created Dialog window. I found it and want to share
    my results now. My application is a simple OpenGL based tool, which shows Ope....
  28. Dubit Informer (uk Based Survey Site)
    Known to be active and pay at £25 (4)
    Heres the blurb: Informer is a unique scheme only for young people who want to make their opinions
    and voices heard and get paid for it. As a member of Informer you will be part of an exclusive group
    of teenagers that is given access to new ideas, new ad campaigns and new technologies – all before
    anyone else!! Members of Informer are the ones who influence which ideas are decent enough
    to take forward – because companies are keen to hear what you think! If that sounds good to
    you heres how to make the money, i already have made some: Once you have been ....
  29. What Is A T_string?
    Please help! I'm new at PHP Programming (13)
    I'm new at PHP, and I looked for a while on here, and found some stuff I was looking for about
    form processing, and sending E-Mail through PHP. However, the script I just created won't work.
    I get the following error: Parse error: parse error, unexpected T_STRING in
    /home/hamtaro/public_html/send_feedback.php on line 9 Exactly what is a T_STRING? If I need to post
    my code, I will.....
  30. Software To Restore Data
    (15)
    Somebody knows software good to restore data. Yesterday one of my disc crash /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> and i have information that i
    want to restore... Someone knows any program to do this??....

    1. Looking for data, structures, string, arrange, based, repetition, string, data, structure

Searching Video's for data, structures, string, arrange, based, repetition, string, data, structure
Similar
Need Help
With My
Database
[resolved] -
retrive data
as a link
Warlords
Series And
Other Turn
Based
Strategy
Games - Both
RTS
(Battlecry)
and TBS
Very
Disappointed
With Data
Center
Migration -
What do you
think?
Free
Newsgroups
(based On
Nntp
Protocol) -
Discussion
on
benefitting
from free
newsgroups
1 Terabyte
Of Data On A
Thumb Drive
- Yes, a
whole
terabyte!
;
Text Based
Rpg Game
Maker
Sending
E-mails
Based On
Intervals?
Unexpected
T_string In
User.php
[resolved]
Eraser -
Erase Your
Data
Permanently&
#33; For
Free - A
must have
software
Text Based
Game
Budding Java
Game
Developers?
- Ever
wanted to
make your
own java
web-based
game, but
not had the
time
Make A Flat
Based
Shoutbox,
With Auto
Refresh.
What Is The
Best
Software -
what is the
best
software to
recovery the
data
Remove A
Value From A
Php Array
Based On Its
Value
Ghostbusters
- The Video
Game - New
movie-based
game coming
Fall 2008
Background
Image Swap
Script -
Change a
Background
Image based
on clock
time
Three Neat
Avatar-based
Sites -
Zantarni,
Menewsha and
Elyzeria
Carpentry
Information
- Based on
my
experiences
as a
Carpenter
How Good Is
This Data
Cleaning
Function?
Data Can Be
Stored On
Paper -
Store
GB's of
electronic
data on
Paper
Get 30 Gb
Email For
Free - let
us talk
about ,
email system
for huge
data !
Travian
Browser
Based Game -
The Travian
Story
New Tech:
Data
Transmiting
At 2.56
Terabites
Per
Second!
- Thats like
60 dvd's
per
second!
C Problem:
"two Or
More Data
Types In
Declaration&
quot; - also
need help
with malloc
Do You Use
(or Plan To)
Asp.net? -
Or some
other .NET
based
evniroment?
My Ipod Is
Randomly
Skipping
Songs,
Losing Data,
- regaining
data, and
freezing
Opengl And
Mfc Dialog
Based
Application
- some
comments
about using
it together
Dubit
Informer (uk
Based Survey
Site) -
Known to be
active and
pay at £25
What Is A
T_string? -
Please
help!
I'm new
at PHP
Programming
Software To
Restore Data
advertisement



Data Structures -- String -- Arrange Based On Repetition - String data structure



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE