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

📄 page92.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>MultiDimensionalArray class __init__ Method</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="tex2html2271" HREF="page93.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html2269" HREF="page89.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html2263" HREF="page91.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html2273" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION004230000000000000000"><tt>MultiDimensionalArray</tt> class <tt>__init__</tt> Method</A></H2><P>The <tt>__init__</tt> method for the <tt>MultiDimensionalArray</tt> classis defined in Program&nbsp;<A HREF="page92.html#progmultiDimensionalArraya"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.The <tt>dimensions</tt> argument is a tuplewhich represents the dimensions of the array.For example,to create a  <IMG WIDTH=63 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline60515" SRC="img610.gif"  > three-dimensional array,we create a <tt>MultiDimensionalArray</tt> like this:<PRE>a = MultiDimensionalArray(3, 5, 7)</PRE><P><P><A NAME="3290">&#160;</A><A NAME="progmultiDimensionalArraya">&#160;</A> <IMG WIDTH=575 HEIGHT=294 ALIGN=BOTTOM ALT="program3131" SRC="img611.gif"  ><BR><STRONG>Program:</STRONG> <tt>MultiDimensionalArray</tt> class <tt>__init__</tt> method.<BR><P><P>The <tt>__init__</tt> method copies the dimensions of the arrayinto the <tt>_dimensions</tt> array,and then it computes the <tt>_factors</tt> array.These operations take <I>O</I>(<I>n</I>),where <I>n</I> is the number of dimensions.The <tt>__init__</tt> method then allocates a one-dimensionalarray of length <I>m</I> given by<P> <IMG WIDTH=288 HEIGHT=46 ALIGN=BOTTOM ALT="displaymath60513" SRC="img612.gif"  ><P>The worst-case running time of the <tt>__init__</tt> method is <I>O</I>(<I>m</I>+<I>n</I>).<P><HR><A NAME="tex2html2271" HREF="page93.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html2269" HREF="page89.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html2263" HREF="page91.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html2273" 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 + -