⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page436.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>Brute-Force Algorithm</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html6198" HREF="page437.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6196" HREF="page435.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6190" HREF="page435.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6200" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0014111000000000000000">Brute-Force Algorithm</A></H3><P>Since each of the elements of  <IMG WIDTH=143 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline67635" SRC="img1702.gif"  >is either a zero or a one,there are  <IMG WIDTH=15 HEIGHT=11 ALIGN=BOTTOM ALT="tex2html_wrap_inline60291" SRC="img558.gif"  > possible values for <I>X</I>.A brute-force algorithm to solve this problemfinds the best solution by enumerating all the possible values of <I>X</I>.<P>For each possible value of <I>X</I> we check firstif the constraint  <IMG WIDTH=102 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline67649" SRC="img1707.gif"  > is satisfied.A value which satisfies the constraint is calleda <em>feasible solution</em><A NAME=32135>&#160;</A>.The solution to the problem is the feasible solution whichminimizes  <IMG WIDTH=53 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline67651" SRC="img1708.gif"  > which is called the<em>objective function</em><A NAME=32139>&#160;</A>.<P>Since there are  <IMG WIDTH=15 HEIGHT=11 ALIGN=BOTTOM ALT="tex2html_wrap_inline60291" SRC="img558.gif"  > possible values of <I>X</I>the running time of a brute-force solution is  <IMG WIDTH=39 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline60189" SRC="img539.gif"  >.The running time needed to determine whether a possible value isa feasible solution is <I>O</I>(<I>n</I>)and the time required to evaluate the objective function is also <I>O</I>(<I>n</I>).Therefore, the running time of the brute-force algorithm is  <IMG WIDTH=49 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline67663" SRC="img1709.gif"  >.<P><HR><A NAME="tex2html6198" HREF="page437.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6196" HREF="page435.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6190" HREF="page435.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6200" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright &#169; 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a>  All rights reserved.</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -