LeetCode - Algorithms - 537. Complex Number Multiplication

Problem

537. Complex Number Multiplication

Java

Complex.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Solution {
public String complexNumberMultiply(String a, String b) {
int re1 = Integer.parseInt(a.substring(0, a.indexOf("+")));
int im1 = Integer.parseInt(a.substring(a.indexOf("+") + 1, a.length() - 1));
Complex c1 = new Complex(re1, im1);
int re2 = Integer.parseInt(b.substring(0, b.indexOf("+")));
int im2 = Integer.parseInt(b.substring(b.indexOf("+") + 1, b.length() - 1));
Complex c2 = new Complex(re2, im2);
Complex c = c1.times(c2);
return c.toString();
}
}

class Complex {
private int re;
private int im;

public Complex(int real, int imag) {
this.re = real;
this.im = imag;
}

public String toString() {
return re + "+" + im + "i";
}

public Complex times(Complex that) {
int real = this.re * that.re - this.im * that.im;
int imag = this.re * that.im + this.im * that.re;
return new Complex(real, imag);
}
}

Submission Detail

  • 55 / 55 test cases passed.
  • Runtime: 4 ms, faster than 81.21% of Java online submissions for Complex Number Multiplication.
  • Memory Usage: 37.6 MB, less than 17.58% of Java online submissions for Complex Number Multiplication.

LeetCode - Algorithms - 334. Increasing Triplet Subsequence

Problem

334. Increasing Triplet Subsequence

Follow up: Could you implement a solution that runs in O(n) time complexity and O(1) space complexity?

Java

Increasing triplet subsequence problem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Solution {
public boolean increasingTriplet(int[] nums) {
int first = Integer.MAX_VALUE;
int second = Integer.MAX_VALUE;
for (int i = 0; i < nums.length; i++) {
if (nums[i] < first)
first = nums[i];
if (nums[i] > first && nums[i] < second) {
second = nums[i];
}
if (nums[i] > second)
return true;
}
return false;
}
}

Submission Detail

  • 75 / 75 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Increasing Triplet Subsequence.
  • Memory Usage: 39.1 MB, less than 9.26% of Java online submissions for Increasing Triplet Subsequence.

Sonnet 3

by William Shakespeare

Look in thy glass and tell the face thou viewest,
Now is the time that face should form another,
Whose fresh repair if now thou not renewest,
Thou dost beguile the world, unbless some mother.
For where is she so fair whose uneared womb
Disdains the tillage of thy husbandry?
Or who is he so fond will be the tomb
Of his self-love, to stop posterity?
Thou art thy mother’s glass, and she in thee
Calls back the lovely April of her prime;
So thou through windows of thine age shalt see,
Despite of wrinkles, this thy golden time.
But if thou live rememb’red not to be,
Die single, and thine image dies with thee.


Spelling Rules

the first spelling rules that students should know

  • Every word has at least one vowel.
  • Every syllable has one vowel.
  • C can say /k/ or /s/. C says /s/ before an e, i, or y (cent, city, cycle). It says /k/ before everything else (cat, clip).
  • G can say /g/ or /j/. G may say /j/ before an e, i, or y (gem, giant, gym). It says /g/ before everything else (garden, glad).
  • Q is always followed by a u (queen).
  • Double the consonants f, l, and s at the end of a one-syllable word that has just one vowel (stiff, spell, pass).
  • To spell the sound of /k/ at the end of a word, we use ck or k. Use ck after a short vowel (sick). After everything else, use a k (milk).
  • Capitalize names.

next set of rules

  • A, e, o, and u usually say their name at the end of a syllable (a-pron, me, go, u-nit).
  • Words do not end in v or j. We add a silent e at the end of the word (have).
  • Contractions replace letter(s) with an apostrophe to shorten a phrase (I’ve represents I have).
  • I and o may say /ī/ and /ō/ before two consonants (kind, sold). /j/ is spelled dge after a short vowel (edge).
  • Capitalize the names of places (Florida).

English Smart - Grade 2 - Note

Phonics

Hard and soft “c” and “g”

C can say /k/ or /s/.

C says soft /s/ before an e, i, or y (cent, city, cycle). It says hard /k/ before everything else (cat, clip).

soft “c”

face
ice
juice
city
circus
cycle
cymbals

G can say /g/ or /j/.

G may say soft /j/ before an e, i, or y (gem, giant, gym). It says hard /g/ before everything else (garden, glad).

soft “g”

orange
bridge
ginger
giant
gym

Silent Consonants

b

  • crumb
  • dumb
  • comb

h

  • spaghetti

k

  • knob

l

  • yolk
  • salmon
  • stalk

Consonant Blends: L Blends

bl

  • blade

cl

  • clam

fl

  • floss

gl

  • glove

pl

  • plant

sl

  • slippers

Consonant Blends: R Blends

br

  • broom

cr

  • crayon

dr

  • dress

fr

  • fresco

gr

  • grass

pr

  • prize

tr

  • trash

Grammar

Vocabulary

petal

Tetrameric flower of a Primrose willowherb showing petals and sepals

Petal

petal

attic

Attic bedroom in Skóga, Iceland.

Attic

attic

cymbal

A type of crash cymbals used in Assam, India.

Cymbal

cymbal

comb

A modern plastic comb

Comb

comb

crumb

Breadcrumbs from a box on a plate

Bread crumbs

crumb

stalk

a part of a plant (such as a petiole or stipe) that supports another

stalk

dumb

dumb

asking dumb questions

clam

A clam shell

Clam

clam

floss

A picture demonstrating the use of floss to remove dental plaque between the teeth

Dental floss

floss

blade

blade

the leaf of an herb or a grass

tiny blades of grass

frisbee

A flying disc with the Wham-O registered trademark "Frisbee"

Frisbee

Frisbee

a plastic disk for tossing between players

dalmatian

A liver Dalmatian female

dalmatian

any of a breed of medium-sized dogs having a white short-haired coat with many black or brown spots

apricot

Apricot and its cross-section

Apricot

apricot

spicy

spicy

Pungency

Chili pepper

Chili pepper

sour

sour

Taste

The most common foods with natural sourness are fruits, such as lemon, grape, orange, tamarind, and bitter melon.

cozy

cozy

The room was warm and cozy.

scorching

scorch

scorching sun

chilly

chilly

noticeably cold

a chilly day

It’s a little chilly outside.

You must be chilly without a coat on.

breezy

breezy

a breezy day

breeze

a light gentle wind

bridegroom

Bridegroom
A bridegroom (often shortened to groom) is a man who is about to be married or who is newlywed.

bridegroom

fresco

The Creation of Adam, a fresco painting by Italian artist Michelangelo

Fresco

fresco

quadrilateral

quadrilateral

Quadrilateral

quadrilateral

smoothie

Strawberry and lemon smoothie

Smoothie

smoothy

juicy

juicy

delta

Delta on Kachemak Bay at low tide

delta

the alluvial deposit at the mouth of a river

River delta

Delta (letter)

fjord

Geirangerfjord, Norway

fjord

Fjord

geyser

Strokkur geyser, Iceland

geyser

Geyser

swamp

A freshwater swamp in Florida, USA

swamp

Swamp

utensil

Various kitchen utensils on a kitchen hook strip.

utensil

Kitchen utensil

blender

blender

An electric blender

Blender

margarine

Margarine in a tub

margarine

Margarine

badminton

Badminton racquets

We play badminton after school.

badminton

Badminton

chipmunk

An eastern chipmunk placing food in its cheek pouch

chipmunk

Chipmunk

jay

Eurasian jay

jay

Jay

cactus

Various Cactaceae

cactus

Cactus

cub

cub

Cub

A cub is the young of certain large predatory animals such as big cats or bears; analogous to a domestic puppy or kitten.

wok

A wok being used for stir frying

wok

Wok

quay

Tourist boat loading passengers at a small quay, Sa Calobra, Majorca, Spain

quay

docked the ferry at the quay to let the passengers off

Wharf

overt

overt message(clear, direct, and obvious message), compared with implied message(hidden message)

overt

figurine

The twelve Chinese zodiac figurines

figurine

Figurine

curry

Variety of Indian vegetable curry

We had chicken curry for dinner.

curry

Curry

Curry is a variety of dishes originating in the Indian subcontinent.

Reading and Writing

what is the setting of the story?

The setting of a story is the place and time of the events.

Section 4 Unit 1 A Balloon Ride

folk tale

A folk tale is a story passed on by people through speech.

Section 4 Unit 2 The Sun and the Ocean

Path Finding

state tree whose root node represents the initial state and edges represent potential moves that transform the state into a new state.

Game Trees

two-player games

tic-tac-toe

Algorithms

  • Minimax algorithm
  • NegMax
  • AlaphaBeta

Search Trees

single-player games

8-puzzle

Search tree can rapidly explode to contain(potentially) billions or trillions of states.

Algorithms

  • A star search

LeetCode - Algorithms - 58. Length of Last Word

Problem

58. Length of Last Word

Java

jdk

1
2
3
4
5
6
7
8
9
10
class Solution {
public int lengthOfLastWord(String s) {
int len = 0;
s = s.trim();
String w = s.substring(s.lastIndexOf(" ") + 1);
if (w != null && !w.isEmpty())
len = w.length();
return len;
}
}

Submission Detail

  • 58 / 58 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Length of Last Word.
  • Memory Usage: 37.3 MB, less than 49.80% of Java online submissions for Length of Last Word.

LeetCode - Algorithms - 347. Top K Frequent Elements

Problem

347. Top K Frequent Elements

Java

Priority queues with comparators

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Solution {
public int[] topKFrequent(int[] nums, int k) {
int[] a = new int[k];
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int i = 0; i < nums.length; i++) {
if (map.containsKey(nums[i])) {
map.put(nums[i], map.get(nums[i]) + 1);
} else {
map.put(nums[i], 1);
}
}

PriorityQueue<Map.Entry<Integer, Integer>> maxHeap = new PriorityQueue<Map.Entry<Integer, Integer>>(k, Map.Entry.<Integer, Integer>comparingByValue().reversed());
for (Map.Entry<Integer, Integer> e : map.entrySet()) {
maxHeap.offer(e);
}

while (k > 0) {
a[--k] = maxHeap.poll().getKey();
}

return a;
}
}

Submission Detail

  • 21 / 21 test cases passed.
  • Runtime: 11 ms, faster than 37.93% of Java online submissions for Top K Frequent Elements.
  • Memory Usage: 41.2 MB, less than 96.44% of Java online submissions for Top K Frequent Elements.

English Smart - Grade 1 - Note

Phonics

Consonants

A consonant is the sound of a letter in a word that is not a vowel(a, e, i, o or u).

Short Vowels

All words contain at least one vowel. Some words with the letter a, e, i, o or u have short vowel sounds.

Rhyming Words

Rhyming words are groups of words that end in the same sounds. Many rhyming words have the same ending spellings.

pear, bear

dish, fish

pylon, bone

Grammar

common noun

A common noun names any person, animal, place, or thing.

such as doctor, dog, country, apple, school, etc.

proper noun

A proper noun names a specific person, animal, place, or thing. It always begins with a capital letter.

such as Husky, Gala, etc.

Days of the week, months of the year, and festival names are proper nouns. They alwasy begin with capital letters. Such as Monday, Halloween.

Singular and Plural Nouns

If a noun ends in “s”, “x”, “ch” or “sh”, add “es” to form its plural.

Articles

“A” is used before a singular noun that begins with a consonant. “An” is used before a singular noun that begins with a vowel. “The” is used before both singular and plural nouns that name particular persons, places, or things.

The Sun is a star found in the middle of the solar system.

We may see a shooting star.

Prepositons of Time

at : a specfic time
on : a day or a date
in : a month, a season, or a year

Types of Sentences

telling sentence

A telling sentence tells about someone or something. It begins with a capital letter and ends with a period.

asking sentence

An asking sentence asks about somenone or something. It begins with a capital letter and ends with a question mark.

surprising sentence

A surprising sentence shows strong emotion like fear, anger, or excitement. It begins with a capital letter and ends with an axclamation mark.

Vocabulary

jug

a large deep container (as of glass, earthenware, or plastic) with a narrow mouth and a handle

French ceramic jug

Jug

jug

jar

a widemouthed container made typically of earthenware or glass

Jar

jar

wand

Wand

wand

yo-yo

Yo-yo

yo-yo

hanger

Various clothes hangers

Clothes hanger

hanger

jelly

a soft somewhat elastic food product made usually with gelatin or pectin especially : a fruit product made by boiling sugar and the juice of fruit

Jelly

jelly

jam

a food made by boiling fruit and sugar to a thick consistency

Jam

jam

jellyfish

marker

Marker pen

marker

lollipop

A Tootsie Roll Pop

a piece of hard candy on the end of a stick

Lollipop

lollipop

marble

An orange and white toothpaste marble

Marble (toy)

marble

pin

A safety pin

Safety pin

pin

neon

neon light

Neon

quill

Ink bottle and quill

Quill

quill

quail

鹌鹑

Quail

quail

rake

Rake (tool)

radish

radish

Radish

radish

top

An assortment of spinning tops

A spinning top, or simply a top, is a toy with a squat body and a sharp point at the bottom, designed to be spun on its vertical axis, balancing on the tip due to the gyroscopic effect.

Top

siren

Warning siren and emergency lights mounted on a fire truck

Siren (alarm)

siren

sap

Sap

sap

veterinarian

A veterinarian (vet), also known as a veterinary surgeon or veterinary physician, is a professional who practices veterinary medicine by treating diseases, disorders, and injuries in non-human animals.

Veterinarian

veterinarian

vampire

the reanimated body of a dead person believed to come from the grave at night and suck the blood of persons asleep.

Vampire

vampire

yarn

An assortment of different colored yarns.

Yarn

yarn

yolk

The yolk of a chicken egg

Yolk

yolk

yogurt

A bowl of yogurt

Yogurt

yogurt

zucchini

striped and uniform-colored zucchini

Zucchini

zucchini

anchor

short vowel sound

Anchors come in a wide variety of shapes, types, and sizes for different conditions, functions and vessels

Anchor

anchor

elf

a small often mischievous fairy.

An elf is a type of humanoid supernatural being in Germanic mythology and folklore.

Elf

elf

cob

A corncob with attached corn kernels

A corncob, also called cob of corn or corn on the cob, is the central core of an ear of corn (also known as maize in Spanish-speaking countries). It is the part of the ear on which the kernels grow. The ear is also considered a “cob” or “pole” but it is not fully a “pole” until the ear is shucked, or removed from the plant material around the ear.

Corncob

corncob

igloo

Community of igloos

Igloo

igloo

pylon

Traffic cones are usually used to divert traffic

Traffic cone

pylon

clip

Binder clip

Binder clip

A bulldog clip

Bulldog clip

A few paper clips of different colors coated in a mix of plastic and rubber

Paper clip

clip

bench

Classic garden bench

Bench (furniture)

bench

bracelet

A bracelet is an article of jewellery that is worn around the wrist.

Bracelet

bracelet

ostrich

common ostrich and Somali ostrich

Ostrich

ostrich

mow

mow

mow the lawn

My dad mows the lawn every Sunday.

peek

peek

Lesile peeks out from behind a tree.

fluffy

fluffy

the fluffy fur of a kitten

indigo

Extract of natural indigo applied to paper

Indigo

indigo

rooster

In most breeds the adult rooster can be distinguished from the hen by his larger comb.

rooster

We heard the crow of a rooster.

cheetah

Cheetah in Sabi Sand Game Reserve, South Africa

Cheetah

cheetah

sunscreen

A tube of SPF 30 sunblock on sale in the United States.

Sunscreen

sunscreen

swimwear

Swimsuit

swimwear

Reading and Writing

Order words

Order words can be used to show the order of events:

First

Next

Then

Finally

Rhyme

A rhyme is a poem with lines ending with words that rhyme.

Words that rhyme sound the same at the end.

Section 4 Unit 4 Fun in the snow

graphic text

Section 4 Unit 5 The wild yak

rebus story

A rebus story uses pictures to represent words.

Section 4 Unit 6 Fun in the Fall

riddle

A riddle is a question that describes something without actually naming it.

Section 4 Unit 7 What am I?

informational text

Section 4 Unit 8 Plants

instruction

Section 4 Making Blueberry Jam

Making Ice Cream Cones

How to Make an Ice Cream Cone

How to Draw a Truck

Sign

Stop sign

The Fir Tree

The tale is about a fir tree so anxious to grow up, so anxious for greater things, that he cannot appreciate living in the moment.

by Hans Christian Andersen

Far away in the forest, where the sun was warm and the air was fresh, grew a pretty little fir tree. Everything was perfect there, and yet the tree was not happy. It wanted so much to be like the tall pine and fir trees that grew around it.
The sun shone, the soft air fluttered its leaves and little children passed by, chatting happily, but the fir tree did not pay them any attention.
Sometimes the children would bring a large basket of raspberries or strawberries and sit eating them near the fir tree.
“Is it not a pretty little tree?” they would ask, which made it feel even more unhappy than before.
And yet all this while the tree grew a little taller every year. Still, as it grew, it complained: “Oh! how I wish I were as tall as the other trees! Then I would spread out my branches on every side, and my top would look out over the wide world around. The birds would be building their nests in my branches, and when the wind blew, I would gently bow, just like my tall companions.”
So unhappy was the tree, that it did not enjoy the warm sunshine, the birds, or the fluffy clouds that floated over it morning and evening.
Sometimes in winter, when the snow lay white on the ground, there was a little hare that would come springing along and jump right over the little tree’s head. This would make the tree very embarrassed, that a mere hare could jump over it.
Two winters passed and when the third arrived, the tree had grown so tall that the hare could not jump over it any more and had to run round it. Yet it remained unsatisfied and would cry “Oh! to grow, to grow, if I could just keep on growing tall and old! There is nothing else worth caring for in the world.”
In the autumn the woodcutters came, as usual, and cut down several of the tallest trees. The young fir, which had now grown to a good height,shook as the trees he wanted to be like so much fell to the earth with a crash.
After the branches were chopped off, the trunks looked so narrow and bare that he could hardly recognise them. Then they were placed, on top of each other, on carts and pulled by horses out of the forest. Where could they be going? What would become of them? The young fir tree wished very much to know.
So in the spring, when the swallows and the storks came, it asked:“Do you know where those trees were taken? Did you meet them?”
The swallows knew nothing, but the stork, after a little reflection, nodded his head and said: “Yes, I think I do. As I flew from Egypt, I met several new ships, and they had fine masts that smelt like fir. These must have been the trees. I promise you they looked grand, they sailed gloriously on the sea!”
“Oh, how I wish I were tall enough to go on the sea,” said the fir tree. “Tell me what is this sea, and what does it look like?”
“It would take too much time to explain—a great deal too much,”said the stork, flying quickly away.
“Enjoy being young,” said the sunbeam. “Enjoy your growing years and the young life that is in you.”
And the wind kissed the tree but the fir tree didn’t pay it any attention.
Christmas time drew near, and many young trees were cut down. These young trees, which were chosen for their beauty, kept their branches, and they, also, were laid on carts and drawn by horses far away out of the forest. The fir tree could not stop wanting to leave its forest home.
“Where are they going?” asked the fir tree. “They are not taller than me. And why do they keep all their branches? Where are they going?
“We know, we know,” sang the sparrows; “we have looked in at the windows of the houses in the town, and we know what is done with them.Oh! you cannot think what honor and glory they receive. They are dressed up in the most wonderfully. We have seen them standing in the middle of a warm room, and dressed up with all sorts of beautiful things—decorations, tinsel, coloured lights and other beautiful objects.
“And then,” asked the fir tree, so excited it began to shake, “and then what happens?”
“We did not see any more,” said the sparrows; “but this was enough for us.”
“I wonder whether anything so great will ever happen to me,”thought the fir tree. “It would be better even than crossing the sea. It hurts, I wantit so much. Oh, when will Christmas be here? I am now as tall and well grown as the ones taken away last year. Oh I wish I was lying now on that cart, or standing in the warm room with all that brightness and beauty around me! Something even better and more beautiful must happen afterwards, or the trees would not be so decorated. Yes, what follows after being decorated in the room will be even more exciting. What can it be? I can’t wait to find out.”
“Be happy with us here,” said the air and the sunlight to the tree.“Enjoy your own bright life in the fresh air.”
But the tree would not be happy, though it grew taller every day. Its dark-green leaves could be seen in the forest, and people passing by would say, “What a beautiful tree!”
A short time before the next Christmas the unhappy fir tree was the first to fall. As the ax cut sharply through the trunk and the tree fell to the earth. It suddenly felt sad knowing it was to leave all its friends, the trees, the bushes, the flowers and the birds. The tree first recovered itself while being unpacked outside a house, with several other trees. It heard a man say: “We only want one, and this is the prettiest. This is beautiful!”
Two men carried the fir tree into a large and beautiful room. Picture shung on the walls and there were china vases all around. There were rocking-chairs, comfortable couches, and large tables covered with pictures. There were fancy carpets on the floor, books on the shelves and very expensive-looking toys.
Then the fir tree was placed in a large tub full of sand—but greencloth hung all round it so that no one could know it was a tub—and it stood on a very lovely carpet. Oh, how the fir tree trembled! What was going to happen to him now? Some young ladies came, and the servants helped them to adorn the tree.
On one branch they hung little bags cut out of colored paper, and each bag was filled with cakes. From other branches hung golden apple sand walnuts, as if they had grown there; and above and all around were hundreds of red, blue, and white candles, which were tied onto the branches. Dolls, exactly like real men and women, were placed under the green leaves,—the tree had never seen such things before,—and at the very top was fastened a glittering star made of gold tinsel. Oh, it was very beautiful. “This evening,” they all exclaimed, “how bright it will be!”
“Oh, I wish that the evening were come,” thought the tree, “and the candles lighted! Then I’ll know what else is going to happen. Will the trees of the forest come to see me? Will the sparrows peep in at the windows, I wonder, as they fly? Shall I grow faster here than in the forest, and shall I keep on all these ornaments during summer and winter?” But guessing was of very little use.
At last the candles were lit, and how beautiful the tree looked! It trembled so with joy in all its branches that one of the candles fell among the green leaves and burned some of them. “Help! help!” exclaimed the young ladies, but no harm was done, for they quickly put out the fire.
After this the tree tried not to shake at all, though the fire frightened him, he was so anxious not to hurt any of the beautiful ornaments.
And now the folding doors were thrown open, and a troop of children rushed in as if they intended to knock over the tree, and were followed more slowly by their elders. For a moment the little ones stood silent with astonishment, and then they shouted for joy and they danced merrily round the tree while one present after another was taken from it.
“What are they doing? What will happen next?” thought the tree. At last the candles burned down to the branches and were put out. Then the children received permission to take whatever they wanted from the tree.
Oh, how they rushed upon it! There was such a fight to grab things that the branches cracked, and had it not been tied with the glistening star to the ceiling, it would have been knocked down.
Then the children danced about with their pretty toys, and no one noticed the tree except the children’s maid, who came and peeped among the branches to see if an apple or a fig had been forgotten.
“What are they doing? What will happen next?” thought the tree.
“A story, a story,” cried the children, pulling a little fat man towards the tree.
“Now we shall be in the green shade,” said the man as he seated himself under it, “and the tree will have the pleasure of hearing, also; but I shall only tell one story. Would you like to hear about Humpty Dumpty, who fell downstairs, but soon got up again, and at last married aprincess?”
“”Yes, Humpty Dumpty,” cried the children loudly. The fir tree remained quiet and thought to himself: “Should I join in? Should I make a noise, too?”
Then the old man told them the story of Humpty Dumpty—how he fell downstairs, and was raised up again, and married a princess. And the children clapped their hands and cried, “Tell another, tell another,” for they wanted to hear another story. After this the fir tree became quite silent and thoughtful. Never had the birds in the forest told such tales as that of Humpty Dumpty, who fell downstairs, and yet married a princess.
“Ah, yes! so that’s what happens in the world,” thought the fir tree.He believed it all, because it was told by such a nice man.
“Ah, well!” he thought, “who knows? Maybe I will fall down, too, and marry a princess;” and he looked forward to the next evening, expecting to be decorated again. “To-morrow I will not shake,” he thought. “I will enjoy how splendid I look, and I shall hear the story of Humpty Dumpty again,and perhaps another story.” And the tree remained quiet and thoughtful all night.
In the morning the servants and the housemaid came in. “Now,”thought the fir tree, ” my decoration is going to begin again.” But they dragged him out of the room and upstairs to the attic and threw him on the floor in a dark corner and there they left him. “What does this mean?”thought the tree. “What am I to do here? I can hear nothing in a place like this,” and he leaned against the wall and thought and thought.
And he had time enough to think, for days and nights passed and no one came near him. When at last somebody did come, it was only to push away some large boxes in a corner. So the tree was completely hidden from sight.
“It is winter now,” thought the tree; “the ground is hard and covered with snow, so that people cannot plant me. I shall be sheltered here, I dare say, until spring comes. How thoughtful and kind everybody is to me! Still,I wish this place was not so dark and lonely, with not even a little hare to look at. How nice it was out in the forest while the snow lay on the ground, when the hare would run by, yes, and jump over me, too,although I did not like it then. Oh! it is terribly lonely here.”
“Squeak, squeak,” said a little mouse, creeping cautiously towards the tree; then came another, and they both sniffed at the fir tree and creptin and out between the branches.
“Oh, it is very cold,” said the little mouse. “If it wasn’t so cold, we’d be very comfortable here, wouldn’t we, old fir tree?”
“I am not old,” said the fir tree. “There are many who are older than I am.”
“Where do you come from?” asked the mice, who were full of curiosity; “and what do you know? Have you seen the most beautiful places in the world, and can you tell us all about them? And have you been in the storeroom, where cheeses lie on the shelf and hams hang from the ceiling?”
“I know nothing of that,” said the fir tree, “but I know the wood, where the sun shines and the birds sing.” And then the tree told the little mice all about its youth. They had never heard such an account in their lives and after they had listened to it attentively, they said: “What a number of things you have seen! You must have been very happy.”
“Happy!” exclaimed the fir tree; and then, as he reflected on what he had been telling them, he said, “Ah, yes! after all, those were happy days.” But when he went on and related all about Christmas Eve, and how he had been dressed up with cakes and lights, the mice said, “How happy you must have been, you old fir tree.”
“I am not old at all,” replied the tree; “I only came from the forest this winter.”
“What splendid stories you can tell,” said the little mice. And the next night four other mice came with them to hear what the tree had to tell. The more he talked the more he remembered, and then he thought to himself: “Yes, those were happy days, but they may come again. Humpty Dumpty fell downstairs, and yet he married the princess. Perhaps I may marry a princess, too.” And the fir tree thought of the pretty little birch tree that grew in the forest; a real princess, a beautiful princess, she was to him.
“Who is Humpty Dumpty?” asked the little mice. And then the tree related the whole story; he could remember every single word. And the little mice were so delighted with it that they were ready to jump to the top of the tree. The next night a great many more mice made their appearance, and on Sunday two rats came with them; but the rats said it was not a pretty story at all, and the little mice were very sorry, for it made them also think less of it.
“Do you know only that one story?” asked the rats.
“Only that one,” replied the fir tree. “I heard it on the happiest evening in my life, but I did not know I was so happy at the time.”
“We think it is a very miserable story,” said the rats. “Don’t you know any story about food in the storeroom?”
“No,” replied the tree.
“Many thanks to you, then,” replied the rats, and they went their ways.
The little mice also kept away after this, and the tree sighed and said: “It was very pleasant when the merry little mice sat round me and listened while I talked. Now that is all past, too. However, I shall consider myself happy when some one comes to take me out of this place.”
But would this ever happen? Yes; one morning people came to clear up the attic. The boxes were packed away, and the tree was pulled out of the corner and thrown roughly on the floor; then the servants dragged it out upon the staircase, where the daylight shone.
“Now life is beginning again,” said the tree, enjoying in the sunshine and fresh air. Then it was carried downstairs and taken into the courtyard so quickly that it forgot to think of itself and could only look about, there was so much to be seen.
The courtyard was close to a garden, where everything looked blooming. Fresh and fragrant roses hung over the little palings. The trees were in blossom, while swallows flew here and there, crying out.
“Now I shall live,” cried the tree joyfully, spreading out its branches; but alas! they were all withered and yellow, and it lay in a corner among weeds and nettles. The star of gold paper still stuck in the top of the tree and glittered in the sunshine.
Two of the merry children who had danced round the tree at Christmas and had been so happy were playing in the same courtyard.The youngest saw the gilded star and ran and pulled it off the tree. “Look what is sticking to the ugly old fir tree,” said the child, treading on the branches till they crackled under his boots.
And the tree saw all the fresh, bright flowers in the garden and then looked at itself and thought of its fresh youth in the forest, of the merry Christmas evening, and of the little mice who had listened to the story of Humpty Dumpty. It imagined itself back in those places and for the first time it was able to enjoy those moments.
“What a fine life I had,” said the tree. “Oh, I know I should have enjoyed myself more while I could have done so! But as I think back, it makes me so happy to think of those wonderful times. And the tree dreamed and dreamed it was back in the forest on a Spring morning, with the breeze blowing, the sun shining and the birds singing. At least, the little tree felt happy.”
Then a lady came and chopped up the tree, till a large bundle lay in a heap on the ground. The pieces were placed in a fire, and they quickly blazed up brightly. Then the children who were at play came and seated themselves in front of the fire, looked at it and warmed themselves. As the fire burned, the tree was thinking of a summer day in the forest and then of some winter night there when the stars shone brightly, and of Christmas evening, and of Humpty Dumpty, the only story it had ever heard or knew how to tell. It happily remembered all these experiences as vividly as though it was living through it all again. And then, finally, the tree was gone.
The boys still played in the garden, and the youngest wore on his chest the golden star that was on top of the tree during the happiest evening of its life. Now all was past, the tree’s life was past and the story also past—for all stories must come to an end at some time or other.