PHPの独学は、団体に所属せず、ただ本を読んで独学で勉強します。
CSS の div 段階は非常にスムーズに学習でき、PHP も最初の 2 週間で非常にスムーズに学習できましたが、配列に関してはほとんど理解できなくなりました。もう配列。
バブル ソート プログラムを 20 回入力しましたが、どうやって 2 つの for ループを思いついたのかまだわかりません。逐次探索と二分探索は全く学習していない。
この段階を乗り越えるにはどうすればよいですか?
授業がないときは、ほぼ一日中 PHP の学習に取り組み、その日に学んだコードを入力することに集中しましたが、まったく理解できませんでした。
この状況でプロジェクトの段階にうまく入ることができますか?諦めるべきでしょうか?
CSS の div 段階は非常にスムーズに学習でき、PHP も最初の 2 週間で非常にスムーズに学習できましたが、配列に関してはほとんど理解できなくなりました。もう配列。私は独学に賛成です。現在、さまざまな機関が何を教えているかは誰もが知っています。しかし、「css div ステージ」とは何でしょうか? HTML 4 には合計でいくつのタグがありますか? CSS 2.1 には合計でいくつのルールがありますか? HTML は何のために設計されたのでしょうか? CSS は何のために設計されたのでしょうか? PHP の構文自体は非常に単純で、基本的には C と同じです。配列に関して言えば、次のような構造になっている場合はどうすればよいでしょうか。オブジェクト指向についてはどうでしょうか?
<code class="language-java"><span class="kn">import</span> <span class="nn">java.util.*</span><span class="o">;</span> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">Sorter</span> <span class="o">{</span> <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span> <span class="kt">int</span><span class="o">[]</span> <span class="n">arr</span> <span class="o">=</span> <span class="n">getIntArray</span><span class="o">(</span><span class="mi">10</span><span class="o">,</span> <span class="o">-</span><span class="mi">50</span><span class="o">,</span> <span class="mi">50</span><span class="o">);</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">print</span><span class="o">(</span><span class="s">"Before: "</span><span class="o">);</span> <span class="n">printArray</span><span class="o">(</span><span class="n">arr</span><span class="o">);</span> <span class="n">bubbleSort</span><span class="o">(</span><span class="n">arr</span><span class="o">);</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">print</span><span class="o">(</span><span class="s">"After : "</span><span class="o">);</span> <span class="n">printArray</span><span class="o">(</span><span class="n">arr</span><span class="o">);</span> <span class="o">}</span> <span class="kd">private</span> <span class="kd">static</span> <span class="kt">int</span><span class="o">[]</span> <span class="nf">getIntArray</span><span class="o">(</span><span class="kt">int</span> <span class="n">capacity</span><span class="o">,</span> <span class="kt">int</span> <span class="n">min</span><span class="o">,</span> <span class="kt">int</span> <span class="n">max</span><span class="o">)</span> <span class="o">{</span> <span class="n">Random</span> <span class="n">random</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Random</span><span class="o">();</span> <span class="kt">int</span><span class="o">[]</span> <span class="n">arr</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">int</span><span class="o">[</span><span class="n">capacity</span><span class="o">];</span> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">capacity</span><span class="o">;</span> <span class="o">++</span><span class="n">i</span><span class="o">)</span> <span class="o">{</span> <span class="n">arr</span><span class="o">[</span><span class="n">i</span><span class="o">]</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="na">nextInt</span><span class="o">(</span><span class="n">max</span> <span class="o">-</span> <span class="n">min</span><span class="o">)</span> <span class="o">+</span> <span class="n">min</span><span class="o">;</span> <span class="o">}</span> <span class="k">return</span> <span class="n">arr</span><span class="o">;</span> <span class="o">}</span> <span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">printArray</span><span class="o">(</span><span class="kt">int</span><span class="o">[]</span> <span class="n">arr</span><span class="o">)</span> <span class="o">{</span> <span class="n">StringBuilder</span> <span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringBuilder</span><span class="o">();</span> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">arr</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="o">++</span><span class="n">i</span><span class="o">)</span> <span class="o">{</span> <span class="n">sb</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="n">arr</span><span class="o">[</span><span class="n">i</span><span class="o">]).</span><span class="na">append</span><span class="o">(</span><span class="s">" "</span><span class="o">);</span> <span class="o">}</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">sb</span><span class="o">.</span><span class="na">toString</span><span class="o">());</span> <span class="o">}</span> <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">bubbleSort</span><span class="o">(</span><span class="kt">int</span><span class="o">[]</span> <span class="n">arr</span><span class="o">)</span> <span class="o">{</span> <span class="k">if</span> <span class="o">(</span><span class="n">arr</span><span class="o">.</span><span class="na">length</span> <span class="o"><</span> <span class="mi">2</span><span class="o">)</span> <span class="k">return</span><span class="o">;</span> <span class="kt">boolean</span> <span class="n">isSorted</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="n">arr</span><span class="o">.</span><span class="na">length</span> <span class="o">-</span> <span class="mi">1</span><span class="o">;</span> <span class="n">i</span> <span class="o">></span> <span class="mi">0</span> <span class="o">&&</span> <span class="o">!</span><span class="n">isSorted</span><span class="o">;</span> <span class="o">--</span><span class="n">i</span><span class="o">)</span> <span class="o">{</span> <span class="n">isSorted</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">j</span> <span class="o"><</span> <span class="n">i</span><span class="o">;</span> <span class="o">++</span><span class="n">j</span><span class="o">)</span> <span class="o">{</span> <span class="k">if</span> <span class="o">(</span><span class="n">arr</span><span class="o">[</span><span class="n">j</span><span class="o">]</span> <span class="o">></span> <span class="n">arr</span><span class="o">[</span><span class="n">j</span><span class="o">+</span><span class="mi">1</span><span class="o">])</span> <span class="o">{</span> <span class="n">swap</span><span class="o">(</span><span class="n">arr</span><span class="o">,</span> <span class="n">j</span><span class="o">,</span> <span class="n">j</span><span class="o">+</span><span class="mi">1</span><span class="o">);</span> <span class="n">isSorted</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> <span class="o">}</span> <span class="o">}</span> <span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">swap</span><span class="o">(</span><span class="kt">int</span><span class="o">[]</span> <span class="n">arr</span><span class="o">,</span> <span class="kt">int</span> <span class="n">indexA</span><span class="o">,</span> <span class="kt">int</span> <span class="n">indexB</span><span class="o">)</span> <span class="o">{</span> <span class="kt">int</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">arr</span><span class="o">[</span><span class="n">indexA</span><span class="o">];</span> <span class="n">arr</span><span class="o">[</span><span class="n">indexA</span><span class="o">]</span> <span class="o">=</span> <span class="n">arr</span><span class="o">[</span><span class="n">indexB</span><span class="o">];</span> <span class="n">arr</span><span class="o">[</span><span class="n">indexB</span><span class="o">]</span> <span class="o">=</span> <span class="n">temp</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> </code>